I am running SWI-Prolog (threaded, 64 bits, version 8.5.7) on my Mac OS Monterey. I have recently lost my ability to arrow up and see history.
I’m not really sure when it went away, but I’ve recently installed this development build of SWI Prolog (8.5.7) and also I recently created a user.pl file:
Only that apparently neither GNU readline nor BSD editline is around when you do the cmake. Re-run cmake . in the build directory which should print the stuff it doesn’t have. Surely it works fine on my M1 running Monterey:
?- current_prolog_flag(readline, X).
X = editline.
And in the build dir
$ otool -L packages/libedit/libedit4pl.so
packages/libedit/libedit4pl.so:
/opt/local/lib/libedit.0.dylib (compatibility version 1.0.0, current version 1.68.0)
@rpath/libswipl.8.dylib (compatibility version 8.0.0, current version 8.5.7)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
Which implies it gets libedit from Macports. For GNU readline you should get a similar story. Both have advantages.
Just downloaded 8.5.7 .dmg file on my Intel macbook air running Monterey. History using up/down arrows works just fine. Also with dark theme (unlikely that causes this problem anyway).
You could try to move ~/.config/swi-prolog/init.pl to see if there is something in the init file that causes problems?
OK, I renamed the entire ~/.config/swi-prolog directory. When I launch 8.5.7, it recreates the ~/.config/swi-prolog/dir-history directory but puts no file in it.
Thinking that maybe it was a permissions problem, I made sure that Everyone has read and write permissions to everything in ~/.config/swi-prolog but that didn’t help (still nothing created).
Then I ran this to make sure the process had permissions to create files:
?- open('/Users/ericzinda/.config/swi-prolog/dir-history/test.txt', write, Out),
write(Out, test),
close(Out).
Out = <stream>(0x600000164700).
This was able to create the test.txt file and write into it properly.
Edit: one other fact that may help: If I run the latest stable, it creates the structure /Users/ericzinda/.config/swi-prolog/dir-history/F4====== and puts history into it correctly as far as I can tell. It just looks like commands I have executed in the top level. Here is some of the content of that file (which looks right to me):
First, does history work in the same session, i.e., can you run a command and use arrow-up to reuse it. I’m getting the impression that the issue is save/restore of the history for a specific directory. Right? I think the save/restore is in boot/history.pl. Its a long time ago that I’ve looked at this code.
Also weird is there are no differences between the latest stable (8.4.2) and 8.5.7 when it comes to the Qt based console or the toplevel command reading code.
A sideways question, what do I get on a Mac by using the Qt based console that I am missing by using any other terminal emulator (there is a decent choice of terminal emulators for Macs).
Basically an app that can be in your dock with some useful menu options to get started. Once you know the commands to call from the terminal for all these operations the added value of the console is IMO limited. P.s. I’m not too convinced about this “decent choice of terminal emulators” on the Mac. I found Hyper, but it is really slow. So far nothing comes close to Linux/Gnome Terminator when it comes to features and (notably) speed. That runs on the Mac using X11 and Homebrew. Unfortunately the port isn’t 100% stable
Two small things remain: the option to open multiple tabs that provide a new toplevel in a new thread at any point in time, even when some query is running in the main tab and the ability to open tools such as the thread monitor at any point in time if you are wondering what some long running query is doing. You can do the latter from the commandline using ^C, break, start the tools, leave the break and continue in nodebug mode.