diff options
author | Timo Sirainen <cras@irssi.org> | 2002-03-11 03:45:57 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-03-11 03:45:57 +0000 |
commit | 8fa39c23a700da647eb22be83b74780e01150799 (patch) | |
tree | a2aabb56fd20ac3711f0dc5d860d67798db3f86c | |
parent | abe4e30256e4babacdec8837abafc3eb0a19e321 (diff) | |
download | irssi-8fa39c23a700da647eb22be83b74780e01150799.zip |
default_color checks moved from fe-text to fe-common, so they work properly
with window-specific themes. also should fix some weird problems related to
them and gui_printtext_after().
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2576 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-common/core/formats.c | 16 | ||||
-rw-r--r-- | src/fe-text/gui-printtext.c | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index b91bc0ee..e014583c 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -918,13 +918,17 @@ char *strip_codes(const char *input) /* send a fully parsed text string for GUI to print */ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text) { + THEME_REC *theme; char *dup, *str, *ptr, type; int fgcolor, bgcolor; int flags; + theme = dest->window != NULL && dest->window->theme != NULL ? + dest->window->theme : current_theme; + dup = str = g_strdup(text); - flags = 0; fgcolor = -1; bgcolor = -1; + flags = 0; fgcolor = theme->default_color; bgcolor = -1; while (*str != '\0') { type = '\0'; for (ptr = str; *ptr != '\0'; ptr++) { @@ -1009,7 +1013,8 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text) break; } case FORMAT_STYLE_DEFAULTS: - fgcolor = bgcolor = -1; + fgcolor = theme->default_color; + bgcolor = -1; flags &= GUI_PRINT_FLAG_INDENT; break; case FORMAT_STYLE_CLRTOEOL: @@ -1049,7 +1054,8 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text) break; case 15: /* remove all styling */ - fgcolor = bgcolor = -1; + fgcolor = theme->default_color; + bgcolor = -1; flags &= GUI_PRINT_FLAG_INDENT; break; case 22: @@ -1065,9 +1071,7 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text) case 27: /* ansi color code */ ptr = (char *) - get_ansi_color(dest->window == NULL || dest->window->theme == NULL ? - current_theme : dest->window->theme, - ptr, + get_ansi_color(theme, ptr, hide_text_style ? NULL : &fgcolor, hide_text_style ? NULL : &bgcolor, hide_text_style ? NULL : &flags); diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index b4862a8e..429937a5 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -150,7 +150,7 @@ static void get_colors(int flags, int *fg, int *bg, int *attr) } if (*fg < 0 || *fg > 15) - *fg = current_theme->default_color; + *fg = -1; if (*bg < 0 || *bg > 15) *bg = -1; |