On one of my computers the default foreground colour for the QT console seems to have been set to white making it invisible on the white background. Selecting it makes it visible. It wasn’t originally this way - the release worked fine for some time - and it isn’t occurring on my other computer. In addition, previously installed releases (e.g., 8.1.32) now have the same issue.
Workarounds:
In init.pl set the color_term environment flag to false and restart.
Load library(themes/dark).
I’ve tried digging into the ansi_term library without much success. For example, the doc says I should be able to query the foreground colour using alias foreground but:
?- ansi_get_color(foreground,RGB).
false.
Not really sure how all this is supposed to work, so hoping I’m just missing something obvious. Any suggestions of how to get out of this welcome.
Further digging seems to indicate that some color table is broken. black, and red both output as white. So print_message(query,halt) isn’t visible while print_message(information,halt) is (in green with a % prefix).
Is the color picker (menu item Settings/Colors …) relevant to this? I’ve never figured out what this is for.
There have been similar issues in the past. The color picker menu can re-arrange the mapping for the 16 ANSI color palette. Somehow that can get mixed up. Possibly remove the config file in ~/.config/swi-prolog (think it is called pqConsole.plist or something like that).
This predicate performs a handshake with normal terminals to find the color mapping. This doesn’t work for pqConsole. It also makes little sense as the console doesn’t listen to some sort of system preferences AFAIK. So, normally all should work find as is in light theme and you can load dark theme if you prefer (or define a new theme ).
This sounds promising. However. the only file in ~/.config/swi-prolog is init.pl (along with directories dir-history and xpce). Also a search of that name fails.
A search on swipl-devel indicates that pqConsole is referenced from library/win_menu.pl and the menu item is associated with pqConsole:select_ANSI_term_colors. But I’m not sure where that reference leads.
Not having a Mac where to debug is making this more difficult than it should be.
I’tried yesterday on a Linux box, and could not spot the problem.
Today I have only Win10, and Qt + MSVC 2017 cannot even compile the (small) project.
(@Jan: seems there is an include of SWI-Stream.h missing, or a misplacing of MSVC flags, since it chockes about unknown ssize_t… will try to solve this…)
The location of the preferences file is handled by QSettings, so, according to the docs and the source, the path could be $HOME/Library/Preferences/com.swi-prolog.pqConsole.plist
If you are using Windows, WSL 2 is releasing/has been released to the public this week. I have it being on the slow ring, but that should not be needed any more.
The com.swi-prolog.pqConsole.plist on the working system matches the on the non-working system except for the MRU2.path, pqMainWindow.pos and pqMainWindow.size values, which is to be expected. So my theory of a corrupted config file doesn’t fit. I’ll keep digging.
You could try to set the environment variable QDEBUG=stderr, or better (since I don’t know where the stderr output could show) an absolute writable path. Then loading the Preferences class should display some info…
OK. Launched SWI_Prolog executable from terminal with QDEBUG=stderr. Just message: Loading preferences from "~/Library/Preferences/com.swi-prolog.pqConsole.plist"
repeated 4 times. QT console text still invisible.
At least numbers 0-7 correspond to custom colours in the picker dialog (2 rows of 8) as follows:
0 2 4 6 ? ? ? ?
1 3 5 7 ? ? ? ?
Note that yellow is currently a rust color, at least on my two systems.
Somehow in my ad hoc testing of the stable release I had re-defined red and black to be the colour white. My bad. But these definitions seem to have been preserved somewhere but it’s not clear where, since deleting the pqConsole.plist didn’t seem to change anything.
Unless I’m missing something, it’s not clear this color picker is very useful and can be problematic, e.g., if black is white, particularly for naive users (like me). ansi_term supports many colour formats (8 bit and 24 bit among others), so re-defining the core colour set isn’t something that is needed IMO. I suggest it at least be removed from the menu. As an escape hatch, it can still be invoked as pqConsole:select_ANSI_term_colors.