diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index 205d3afe..49250513 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -225,7 +225,7 @@ static void line_add_colors(GUI_WINDOW_REC *gui, int fg, int bg, int flags) if (((fg & ATTR_COLOR8) == 0 && (fg|(bg << 4)) != gui->last_color) || ((fg & ATTR_COLOR8) && (fg & 0xf0) != (gui->last_color & 0xf0))) { buffer[pos++] = 0; - buffer[pos++] = color; + buffer[pos++] = color == 0 ? LINE_CMD_COLOR0 : color; } if ((flags & PRINTFLAG_UNDERLINE) != (gui->last_flags & PRINTFLAG_UNDERLINE)) { diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index 5267796d..ddfee2ba 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -287,6 +287,9 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui, LINE_REC *line case LINE_CMD_UNDERLINE: color ^= ATTR_UNDERLINE; break; + case LINE_CMD_COLOR0: + color = color & ATTR_UNDERLINE; + break; case LINE_CMD_COLOR8: color &= 0xfff0; color |= 8|ATTR_COLOR8; @@ -413,6 +416,9 @@ static void single_line_draw(GUI_WINDOW_REC *gui, int ypos, LINE_CACHE_SUB_REC * case LINE_CMD_UNDERLINE: color ^= ATTR_UNDERLINE; break; + case LINE_CMD_COLOR0: + color = color & ATTR_UNDERLINE; + break; case LINE_CMD_COLOR8: color &= 0xfff0; color |= 8|ATTR_COLOR8; diff --git a/src/fe-text/gui-windows.h b/src/fe-text/gui-windows.h index 4eb532e7..bcde75c5 100644 --- a/src/fe-text/gui-windows.h +++ b/src/fe-text/gui-windows.h @@ -16,6 +16,7 @@ enum { LINE_CMD_EOL=0x80, /* line ends here. */ LINE_CMD_CONTINUE, /* line continues in next block */ LINE_CMD_OVERFLOW, /* buffer overflow! */ + LINE_CMD_COLOR0, /* change to black, would be same as \0\0 but it breaks things.. */ LINE_CMD_COLOR8, /* change to dark grey, normally 8 = bold black */ LINE_CMD_UNDERLINE, /* enable/disable underlining */ LINE_CMD_INDENT /* if line is split, indent it at this position */ @@ -37,7 +38,10 @@ typedef struct { typedef struct { /* text in the line. \0 means that the next char will be a color or command. <= 127 = color or if 8.bit is set, the - first 7 bits are the command. See LINE_CMD_xxxx. */ + first 7 bits are the command. See LINE_CMD_xxxx. + + DO NOT ADD BLACK WITH \0\0 - this will break things. Use + LINE_CMD_COLOR0 instead. */ char *text; int level;