From e9b4833c484cf14ebe4a837f4aedf5d3c73ec7b8 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 1 Apr 2001 00:31:02 +0000 Subject: [PATCH] gui_window_line2text(): don't keep track of colors - if fg or bg doesn't change, just use FORMAT_COLOR_NOCHANGE instead of figuring out what it should be. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1435 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-windows.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c index 7e7666f8..835a77cd 100644 --- a/src/fe-text/gui-windows.c +++ b/src/fe-text/gui-windows.c @@ -810,7 +810,6 @@ static void signal_window_changed(WINDOW_REC *window) void gui_window_line2text(LINE_REC *line, int coloring, GString *str) { - int color; unsigned char cmd; char *ptr, *tmp; @@ -819,7 +818,6 @@ void gui_window_line2text(LINE_REC *line, int coloring, GString *str) g_string_truncate(str, 0); - color = 0; for (ptr = line->text;;) { if (*ptr != 0) { g_string_append_c(str, *ptr); @@ -850,28 +848,23 @@ void gui_window_line2text(LINE_REC *line, int coloring, GString *str) if ((cmd & 0x80) == 0) { /* set color */ - color = cmd; g_string_sprintfa(str, "\004%c%c", - (color & 0x0f)+'0', - ((color & 0xf0) >> 4)+'0'); + (cmd & 0x0f)+'0', + ((cmd & 0xf0) >> 4)+'0'); } else switch (cmd) { case LINE_CMD_UNDERLINE: g_string_append_c(str, 31); break; case LINE_CMD_COLOR0: g_string_sprintfa(str, "\004%c%c", - '0', ((color & 0xf0) >> 4)+'0'); + '0', FORMAT_COLOR_NOCHANGE); break; case LINE_CMD_COLOR8: g_string_sprintfa(str, "\004%c%c", - '8', ((color & 0xf0) >> 4)+'0'); - color &= 0xfff0; - color |= 8|ATTR_COLOR8; + '8', FORMAT_COLOR_NOCHANGE); break; case LINE_CMD_BLINK: - color |= 0x80; - g_string_sprintfa(str, "\004%c%c", (color & 0x0f)+'0', - ((color & 0xf0) >> 4)+'0'); + g_string_sprintfa(str, "\004%c", FORMAT_STYLE_BLINK); break; case LINE_CMD_INDENT: break;