[sourceware-bugzilla@sources.redhat.com: [Bug cygwin DLL/514] cygwin terminal: wrong color handling in reverse display mode]

Christopher Faylor me@cgf.cx
Mon Nov 15 21:56:00 GMT 2004


Anyone interested in working on cygwin and fixing some
low hanging fruit?

cgf

----- Forwarded message from towo at towo dot net <sourceware-bugzilla> -----

------- Additional Comments From towo at towo dot net  2004-11-11 11:00 -------
The bug is in fhandler_console.cc, function get_win32_attr, where 
foreground and background intensity are explicitly preserved while 
exchanging color values:
      WORD save_fg = win_fg;
      win_fg = (win_bg & BACKGROUND_RED   ? FOREGROUND_RED   : 0) |
               (win_bg & BACKGROUND_GREEN ? FOREGROUND_GREEN : 0) |
               (win_bg & BACKGROUND_BLUE  ? FOREGROUND_BLUE  : 0) |
               (win_fg & FOREGROUND_INTENSITY);
      win_bg = (save_fg & FOREGROUND_RED   ? BACKGROUND_RED   : 0) |
               (save_fg & FOREGROUND_GREEN ? BACKGROUND_GREEN : 0) |
               (save_fg & FOREGROUND_BLUE  ? BACKGROUND_BLUE  : 0) |
               (win_bg & BACKGROUND_INTENSITY);

This approach is wrong (because it's causing unreadable display) 
and should probably be replaced with just:
      WORD save_fg = win_fg;
      win_fg = win_bg;
      win_bg = save_fg;

----- End forwarded message -----



More information about the Cygwin-developers mailing list