cmenu: fix background color
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Mon, 31 Aug 2009 06:37:01 +0000 (23:37 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Tue, 1 Sep 2009 18:45:11 +0000 (11:45 -0700)
The menu highlights some characters to mark them as key shortcuts.
To switch the bold attribute off, we were printing the reset code,
resetting the background color in the same time.

Use ANSI sequence 22 instead.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
com32/cmenu/libmenu/com32io.c

index 92344da..ca207ee 100644 (file)
@@ -37,8 +37,12 @@ static void cprint_vga2ansi(const char chr, const char attr)
                *p++ = '\033';
                *p++ = '[';
 
+               /* Beware! Do not use '1': this will reset all attributes off,
+                * including the background color - as a result, the background
+                * would be black after the highlight area <X> */
                if (last_attr & ~attr & 0x88) {
-                       *p++ = '0';
+                       *p++ = '2';
+                       *p++ = '2';
                        *p++ = ';';
                }
                if (attr & 0x08) {