summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fe-common/core/formats.c16
-rw-r--r--src/fe-text/gui-printtext.c2
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;