bugGNU Octave - Bugs: bug #57658, [MXE Octave] grey text color after...

 
 

bug #57658: [MXE Octave] grey text color after mkoctfile error message in gui terminal widget

Submitter:  Hartmut <hardy>
Submitted:  Thu 23 Jan 2020 08:45:16 AM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 25 Oct 2020 09:31:43 AM UTC, comment #39: 

This seems to work for me now. Verified with `pkg install -forge geometry`.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Thu 22 Oct 2020 12:09:08 PM UTC, comment #38: 

I pushed the patch here:
https://hg.savannah.gnu.org/hgweb/octave/rev/1152256be2cf

Already marked as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Wed 21 Oct 2020 09:38:18 AM UTC, comment #37: 

(personal opinion:) I find the grey text in the lower pic in comment #30 easier to read. It's probably my age (mid-60), I often find that e.g., a web page with grey text on white background makes for very tiring reading.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 21 Oct 2020 06:53:02 AM UTC, comment #36: 

@Markus, I think both versions of comment #30 are readable.  Errors should remain an exception, thus hopefully not too many users will have to read these kinds of error messages on a regular basis.

If you think the patch of comment #30 is useful, please apply it and close this report.  When it reveals as ugly or unreadable, new bug reports will deal with it.

Kai Torben Ohlhus <siko1056>
Group Member
Wed 10 Jun 2020 01:06:15 PM UTC, comment #35: 

We never came to an agreement of whether we want to swap the "foreground colors" with the "background colors" in the color palette for Windows.
The original palette was copied from the command window on Windows which uses a black background by default. The command window in Octave uses a white background by default.

I personally find the light grey text on white background quite difficult to read. So I proposed to swap the colors in the color palette.
But there were objections because this color palette is hard-coded and a user would not be able to set these colors manually.

Markus Mützel <mmuetzel>
Group administrator
Tue 09 Jun 2020 09:29:00 PM UTC, comment #34: 

This was marked Ready for Test back in February.  Can it be closed now?

Rik <rik5>
Group administrator
Sat 22 Feb 2020 01:23:55 PM UTC, comment #33: 

Maybe I should have written "There are 16 arbitrary colors a Windows terminal can use."
Of course we could create our very own color palette that would best fit our needs. But I'm not a graphics designer (or whatever professional would pick colors). Using darker foreground colors on the default white background would be good enough (TM) imho.
Any thoughts?

Markus Mützel <mmuetzel>
Group administrator
Fri 21 Feb 2020 08:53:57 PM UTC, comment #32: 

The CMD window win windows only shows 16 colors colors for me.
Looking at CHAR_INFO attributes field, it only uses 4 bits for forground and 4 for background color

By 16 colors that is 16 color indexes at any given time, not that there are only 16 discrete colors you ever choose.

The color map currently used in libqterminal/win32/QTerminalColors.cpp appears to match the default colors CMD, which are build around the black backround

John Donoghue <lostbard>
Group Member
Fri 21 Feb 2020 08:19:13 PM UTC, comment #31: 

@Markus, comment #29:
"16 colors a terminal can use"- I suppose you refer to the output of terminal programs like gcc, rather than "a" terminal?
The GUI command pane has much more than 16 colors available for back- and foreground and more. e.g., I usually set the GUI command pane background to light yellow.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 21 Feb 2020 05:30:48 PM UTC, comment #30: 

Please, see the attached patch for the described change and screenshots from before and after the patch.

(file #48463,

Markus Mützel <mmuetzel>
Group administrator
Fri 21 Feb 2020 03:59:44 PM UTC, comment #29: 

That change would only affect the command window of the GUI on Windows.

Some background: There are 16 colors a terminal can use. Programs (like gcc or make) select the colors by their index. The terminal "decides" which colors it wants to use for which index.
The mapping from index to color is hard-coded and cannot be changed by the user. Even if that could be changed, I'd like to leave it that way. However, a user could manually select a color index (foreground and background) with a command like:
system ("color F0")

The color palette we are currently using seems to be set up for a dark background, i.e. the higher color indices that are usually chosen as the foreground color are quite bright.
Since we are using a white background in the command window, I'd like to propose changing the color palette to have the darker shades of the same colors at the higher indices.

Markus Mützel <mmuetzel>
Group administrator
Fri 21 Feb 2020 03:21:11 PM UTC, comment #28: 

if we're changing the default color scheme, are the controls (either gui or command) documented for setting/reverting the colors? is it OS dependent? (I know some interpreter behaviors are platform specific?)

Nicholas Jankowski <nrjank>
Group Member
Fri 21 Feb 2020 03:13:36 PM UTC, comment #27: 

I tried your latest patch (from comment #26) and reverted eb46a9f47164. After cross-compiling for Windows, the output of mkoctfile is colorful and the text color stays black.
Also tested with "pkg install -forge geometry".
Perfect results.

So I pushed your patch on stable here:
http://hg.savannah.gnu.org/hgweb/octave/rev/74bc925ae235
and revert hg id eb46a9f47164 here:
http://hg.savannah.gnu.org/hgweb/octave/rev/a578890b4942

Do we also want to swap all light and dark colors to get a better contrast to the white background?

Markus Mützel <mmuetzel>
Group administrator
Fri 21 Feb 2020 01:25:10 PM UTC, comment #26: 

Updated patch, that also makes the background a little more consistant when colors change



(file #48461)

John Donoghue <lostbard>
Group Member
Tue 18 Feb 2020 09:49:53 PM UTC, comment #25: 

just to add to this, currently the windows 5.2.0 bundles with geometry 3.0.0.  so anyone running a pkg update will currently pull geometry 4.0.0, which has a warning currently triggering the color change. So until a new geometry without the warning is released (last was 2017) it'll hit everyone who updates once.

It was nice to find that the interpreter has color options. but I hadn't missed it and could do without it for now if that's the easiest hack to fix it.


Nicholas Jankowski <nrjank>
Group Member
Tue 18 Feb 2020 02:33:50 AM UTC, comment #24: 

Rather than disabling colors, how about changing the color used ? See attached patch.


(file #48439)

John Donoghue <lostbard>
Group Member
Mon 17 Feb 2020 09:55:53 PM UTC, comment #23: 

Running:

system("color F0")

Sets back the correct colors for me - which is what we are setting for SetConsoleTextAttribute

https://hg.savannah.gnu.org/hgweb/octave/file/11072ea6a16c/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp#l393

John Donoghue <lostbard>
Group Member
Mon 17 Feb 2020 06:51:24 PM UTC, comment #22: 

I see that color 7 is the general reset color index, (which in our terminal is light gray).

We set it to be different colors using SetConsoleTextAttribute, which I bet the color reset is then also resetting.


John Donoghue <lostbard>
Group Member
Mon 17 Feb 2020 06:15:00 PM UTC, comment #21: 

hmmm ... you are right.

Its actually stoping colors being used, however the reset of color is still being done which seems to be the one breaking things.

John Donoghue <lostbard>
Group Member
Mon 17 Feb 2020 03:46:28 PM UTC, comment #20: 

John, can you provide a cset for comment #19?  When I patch octave.vbs like this:


If GUI_MODE = 1 then
  AllArgs = AllArgs & " " & chr(34) & "--gui" & chr(34)
  wshSystemEnv("GCC_COLORS") = "error=00:warning=00:note=00:range1=00:range2=00:locus=00:quote=00:fixit-insert=00:fixit-delete=00:diff-filename=00:diff-hunk=00:diff-delete=00:diff-insert=00"
  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 0
Else
  wshShell.Run chr(34) & OctavePath & "\bin\octave-gui.exe" & Chr(34) & AllArgs, 1
End If


and revert my cset

https://hg.savannah.gnu.org/hgweb/octave/rev/eb46a9f47164

my text still fades to gray.

Kai Torben Ohlhus <siko1056>
Group Member
Mon 17 Feb 2020 01:48:48 PM UTC, comment #19: 

Looking more into GCC_COLORS environment var, setting it go GCC_COLORS="" doesn't seem to disable colors as the docs appear to suggest, however, setting it to

GCC_COLORS="error=00:warning=00:note=00:range1=00:range2=00:locus=00:quote=00:fixit-insert=00:fixit-delete=00:diff-filename=00:diff-hunk=00:diff-delete=00:diff-insert=00"

Does seem to disable it, so maybe we can just set the env var in octave.vbs.

John Donoghue <lostbard>
Group Member
Mon 17 Feb 2020 06:39:10 AM UTC, comment #18: 

Thank you for the hint Mike


diff -r 75a90bfc14b1 scripts/pkg/private/configure_make.m
--- a/scripts/pkg/private/configure_make.m        Fri Jan 31 10:45:13 2020 -0800
+++ b/scripts/pkg/private/configure_make.m        Mon Feb 17 15:36:39 2020 +0900
@@ -57,6 +57,12 @@ function configure_make (desc, packdir,
     cenv = {"MKOCTFILE"; mkoctfile_program;
             "OCTAVE_CONFIG"; octave_config_program;
             "OCTAVE"; octave_binary};
+    if (ispc () && isguirunning ())
+      ## FIXME: Remove this branch when the MS Windows GUI terminal widget can
+      ##        properly handle colors (bug #57658).
+      cenv = [cenv; {"CXXFLAGS";
+                     ["-fdiagnostics-color=never " getenv("CXXFLAGS")]}];
+    endif
     scenv = sprintf ("%s='%s' ", cenv{:});

     ## Configure.


I was also fine with the restart solution Mike ;-)  I do not often install packages, but I am no pkg developer...

Kai Torben Ohlhus <siko1056>
Group Member
Mon 17 Feb 2020 06:32:07 AM UTC, comment #17: 

In my opinion, it would be better to do nothing, and tell users to restart Octave after installing a package if this happens.

But if you think it's important to inject something into the CXXFLAGS, please get the user value, if any, with getenv, and add the -fdiagnostics-color at the beginning or end.

Mike Miller <mtmiller>
Group Member
Mon 17 Feb 2020 05:39:47 AM UTC, comment #16: 

pkg is indeed sneaking around Octave's convenience wrapper by calling make directly.

https://hg.savannah.gnu.org/hgweb/octave/file/eb46a9f47164/scripts/pkg/private/configure_make.m#l94

Unless there are more spots like this in Octave, I propose the following additional patch:


diff -r 75a90bfc14b1 scripts/pkg/private/configure_make.m
--- a/scripts/pkg/private/configure_make.m        Fri Jan 31 10:45:13 2020 -0800
+++ b/scripts/pkg/private/configure_make.m        Mon Feb 17 14:29:37 2020 +0900
@@ -57,6 +57,11 @@ function configure_make (desc, packdir,
     cenv = {"MKOCTFILE"; mkoctfile_program;
             "OCTAVE_CONFIG"; octave_config_program;
             "OCTAVE"; octave_binary};
+    if (ispc () && isguirunning ())
+      ## FIXME: Remove this branch when the MS Windows GUI terminal widget can
+      ##        properly handle colors (bug #57658).
+      cenv = [cenv; {"CXXFLAGS"; "-fdiagnostics-color=never"}];
+    endif
     scenv = sprintf ("%s='%s' ", cenv{:});

     ## Configure.


It works at least on my MS Win 10 VM.

We stay on m-code.  Anyone can easily test gcc colors by removing the code.

On mkoctfile.cc level we have no change to detect if a running GUI called the program.  Thus the decision has to be made to forbid colors in MS Windows entirely.  This I find a pity, since in the terminal they look great.

Unfortunately for Octave 5.2.0 it is too late but for Octave 6 it can get in easily.

Kai Torben Ohlhus <siko1056>
Group Member
Fri 14 Feb 2020 08:47:25 PM UTC, comment #15: 

I just realized for the change to mkoctfile.m, thats only going to work for something that calls mkoctfile from a octave script.

The makefile from a pkg install etc will just call the mkoctfile exe directly.

So to disable the colors being sent to gcc would need the gcc command line changed in the mkoctfile.cc sources.

John Donoghue <lostbard>
Group Member
Tue 28 Jan 2020 02:05:14 AM UTC, comment #14: 

I pushed the following hotfix to stable for Octave 5.2.0:

https://hg.savannah.gnu.org/hgweb/octave/rev/eb46a9f47164

This way we can easily try out if the MS Windows GUI terminal colors are working, just by editing an m-file.

The patch regards the idea of Markus (comment #7) to only avoid colors in the GUI terminal.  In the CLI the colors are indeed very nice.

I rename this item and mark it "dev" problem.

Kai Torben Ohlhus <siko1056>
Group Member
Sun 26 Jan 2020 09:43:16 AM UTC, comment #13: 

I can remember these attempts, too, it was patch #9024. It seems, that there were already some problems with the console window under windows.

Torsten Lilge <ttl>
Group Member
Sat 25 Jan 2020 09:57:46 PM UTC, comment #12: 

BTW, there was an attempt several years back to have colored text in the terminal, e.g., red for errors (can't find it now, IIRC Lachlan worked on it). That attempt stranded because -of all places- in Windows the patch didn't work. It was s/th with ANSI sequences IIRC.
But apparently colors do work somehow in the Windows terminal; maybe time to revive that attempt?

Philip Nienhuis <philipnienhuis>
Group Member
Sat 25 Jan 2020 07:26:33 PM UTC, comment #11: 

To answer my own question, seeting that doesnt work.

Perhaps related, using the octave cli:

 printf('\033[1;34m%s\033[m', "This is text")

Prints the text in blue, however in the GUI disabled a symbol for the esc character.

In octave cli, if I run getenv , it will display an error for the usag and then from that point shows a symbol instead of using the esc code.

John Donoghue <lostbard>
Group Member
Sat 25 Jan 2020 06:51:46 PM UTC, comment #10: 

How about setting env var GCC_COLORS = "" ?

John Donoghue <lostbard>
Group Member
Sat 25 Jan 2020 02:15:08 PM UTC, comment #9: 

Yeah I remember this started happening after an mxe-octave update.

For us contributors/ developers a good reason to stay up-to-date :-)

cc-íng JohnD. Perhaps he can mend s/th in mxe-octave.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 24 Jan 2020 09:41:58 PM UTC, comment #8: 

My test in comment #4 (no colors) was with gcc 8.4.0, thus, I havn't updated my mxe environment for quite a long time.

+1 for the workaround proposed by Kai.

Torsten Lilge <ttl>
Group Member
Fri 24 Jan 2020 09:43:11 AM UTC, comment #7: 

It looks like the colors in the GUI are the same as the ones in the CLI. These colors have a nice contrast to the black background in the CLI. But some of them are poorly visible against the white background in the GUI.

Is there a way to set the default foreground color for the Windows console? I didn't find any.

The command window on Windows has many deficiencies anyway. And I still hope that we might have a true cross-platform replacement sometime in the future. Thus, I think Kai's work-around might be a good intermediate fix. Maybe we could limit the impact by only adding that option on Windows when using the GUI.

Markus Mützel <mmuetzel>
Group administrator
Fri 24 Jan 2020 08:55:32 AM UTC, comment #6: 

Very impressive ^^  My idea is that gcc is tampering with the terminal colors since recent versions.

For Octave 5.1.90:


>> system ("gcc -v")
  [...]
gcc version 9.2.0 (GCC)


For Octave 5.1.90:


>> system ("gcc -v")
  [...]
gcc version 7.4.0 (GCC)


To get some sort of "normal" colors back, one can use


system ("COLOR 01")


or has to restart the Octave session.  Maybe there is a smarter command to reset the window colors?  Please share.


To totally avoid this tampering, if I compile with


mkoctfile -fdiagnostics-color=never .......


https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Diagnostic-Message-Formatting-Options.html

Then it looks pretty much "colorless" as in Octave 5.1.0.  Thus an emergency change would be to add "-fdiagnostics-color=never" to the standard options of mkoctfile.

Thoughts?

Kai Torben Ohlhus <siko1056>
Group Member
Thu 23 Jan 2020 09:09:08 PM UTC, comment #5: 

I have just installed the Octave 5.1.90 exe installer (octave-5.1.90-w64-installer.exe from https://octave.space, Jan 16 version, but same md5 hash as the exe installer on alpha.gnu.org) on a Windows 10 machine. No extra tweaks that I would know of. Win 10 itself is some long-term-support Enterprise version (I could find out precisly if someone tells me it's interesting.)

Hartmut <hardy>
Thu 23 Jan 2020 09:02:24 PM UTC, comment #4: 

Linux does not seem to be affected.
When I try to reproduce this in windows, I do not get colored error messages and the text stays black afterwards. Is there a special trick to get colored error messages in windows (in Linux, I see them, too).

Torsten Lilge <ttl>
Group Member
Thu 23 Jan 2020 01:07:06 PM UTC, comment #3: 

Oopps, yes I've uploaded a "good" screenshot twice, and the "bad" one was missing. I'll attach it now. (And the filenames are misleading, there is no "error" anywhere, except for the described gray text color in version 5.1.90 GUI.)


Hartmut <hardy>
Thu 23 Jan 2020 11:35:46 AM UTC, comment #2: 

@Hartmut: All attached screenshots look good to me. You might have unintentionally uploaded the same screenshot twice.

Markus Mützel <mmuetzel>
Group administrator
Thu 23 Jan 2020 10:20:14 AM UTC, comment #1: 

Confirmed with dev Octave.

TBH I noted this already some weeks ago while installing earlier versions of the ocl package (which provoked many warnings and errors), but I didn't bother (other priorities).

Philip Nienhuis <philipnienhuis>
Group Member
Thu 23 Jan 2020 08:45:16 AM UTC, original submission:  

I have observed the following in Octave 5.1.90 (and not in Octave 5.1.0). I have seen this under Windows 10, but am unsure if it also happens under Linux.

Here is how to reproduce the behavior:

  • start the Octave GUI (for information on CLI see below)
  • do something that starts a compilation which will throw an error, maybe a "mkoctfile ..." will do, I used a "pkg install ...".
  • the error message will be displayed in nice and useful colors
  • at the end of the error message the text will turn to grey color (I am unsure if this is intentional)
  • but afterwards, the text color will not return to black and STAY IN GRAY text color. This looks wrong.


In CLI Octave this looks alright, the very error will also be displayed in (red and green) color, and afterwards the text color returns to white on black.

I will attach screenshots to show the colorful behavior.

(This might also happen in dev Octave, I haven't tested for it.)

Hartmut <hardy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #48463:  bug57658_swap_light_dark.patch added by mmuetzel (2KiB - application/octet-stream)
file #48461:  colors2.patch added by lostbard (4KiB - application/octet-stream)
file #48446:  Capture.PNG added by nrjank (56KiB - image/png - pkg install color change error)
file #48439:  colors.patch added by lostbard (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by philipnienhuis
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by hardy (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 25 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-25 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-02-21 mmuetzel Attached File- Added bug57658_swap_light_dark.patch, #48463
        Attached File- Added bug57658_terminal_colors_before.PNG, #48464
        Attached File- Added bug57658_terminal_colors_after.PNG, #48465
    2020-02-21 mmuetzel StatusNeed Info Ready For Test
    2020-02-21 lostbard Attached File- Added colors2.patch, #48461
    2020-02-18 nrjank Attached File- Added Capture.PNG, #48446
    2020-02-18 lostbard Attached File- Added colors.patch, #48439
    2020-02-17 siko1056 StatusIn Progress Need Info
    2020-01-28 rik5 Carbon-CopyRemoved 72865 -
    2020-01-28 rik5 StatusConfirmed In Progress
    2020-01-28 siko1056 StatusNeed Info Confirmed
        Release5.1.90 dev
        Summarygrey text color after error message in gui console [MXE Octave] grey text color after mkoctfile error message in gui terminal widget
    2020-01-25 philipnienhuis Carbon-Copy- Added lostbard
    2020-01-24 siko1056 StatusConfirmed Need Info
    2020-01-23 mtmiller Releaseother 5.1.90
        Summarygrey text color after error message in gui console (Octave 5.1.90) grey text color after error message in gui console
    2020-01-23 hardy Attached File- Added error_in_5.1.90_=_nice_colors_but_stays_gray.png, #48278
    2020-01-23 philipnienhuis Item GroupInaccurate Result Incorrect Result
        StatusNone Confirmed
    2020-01-23 hardy Attached File- Added error@in@5.1.0@GUI=@black+white.png, #48275
        Attached File- Added error@in@5.1.90@CLI@=@nice@colors.png, #48276
        Attached File- Added error@in@5.1.0@GUI=@black+white.png, #48277

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code