mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
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
This commit is contained in:
parent
abe4e30256
commit
8fa39c23a7
@ -918,13 +918,17 @@ char *strip_codes(const char *input)
|
|||||||
/* send a fully parsed text string for GUI to print */
|
/* send a fully parsed text string for GUI to print */
|
||||||
void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
||||||
{
|
{
|
||||||
|
THEME_REC *theme;
|
||||||
char *dup, *str, *ptr, type;
|
char *dup, *str, *ptr, type;
|
||||||
int fgcolor, bgcolor;
|
int fgcolor, bgcolor;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
theme = dest->window != NULL && dest->window->theme != NULL ?
|
||||||
|
dest->window->theme : current_theme;
|
||||||
|
|
||||||
dup = str = g_strdup(text);
|
dup = str = g_strdup(text);
|
||||||
|
|
||||||
flags = 0; fgcolor = -1; bgcolor = -1;
|
flags = 0; fgcolor = theme->default_color; bgcolor = -1;
|
||||||
while (*str != '\0') {
|
while (*str != '\0') {
|
||||||
type = '\0';
|
type = '\0';
|
||||||
for (ptr = str; *ptr != '\0'; ptr++) {
|
for (ptr = str; *ptr != '\0'; ptr++) {
|
||||||
@ -1009,7 +1013,8 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FORMAT_STYLE_DEFAULTS:
|
case FORMAT_STYLE_DEFAULTS:
|
||||||
fgcolor = bgcolor = -1;
|
fgcolor = theme->default_color;
|
||||||
|
bgcolor = -1;
|
||||||
flags &= GUI_PRINT_FLAG_INDENT;
|
flags &= GUI_PRINT_FLAG_INDENT;
|
||||||
break;
|
break;
|
||||||
case FORMAT_STYLE_CLRTOEOL:
|
case FORMAT_STYLE_CLRTOEOL:
|
||||||
@ -1049,7 +1054,8 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
|||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
/* remove all styling */
|
/* remove all styling */
|
||||||
fgcolor = bgcolor = -1;
|
fgcolor = theme->default_color;
|
||||||
|
bgcolor = -1;
|
||||||
flags &= GUI_PRINT_FLAG_INDENT;
|
flags &= GUI_PRINT_FLAG_INDENT;
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
@ -1065,9 +1071,7 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
|||||||
case 27:
|
case 27:
|
||||||
/* ansi color code */
|
/* ansi color code */
|
||||||
ptr = (char *)
|
ptr = (char *)
|
||||||
get_ansi_color(dest->window == NULL || dest->window->theme == NULL ?
|
get_ansi_color(theme, ptr,
|
||||||
current_theme : dest->window->theme,
|
|
||||||
ptr,
|
|
||||||
hide_text_style ? NULL : &fgcolor,
|
hide_text_style ? NULL : &fgcolor,
|
||||||
hide_text_style ? NULL : &bgcolor,
|
hide_text_style ? NULL : &bgcolor,
|
||||||
hide_text_style ? NULL : &flags);
|
hide_text_style ? NULL : &flags);
|
||||||
|
@ -150,7 +150,7 @@ static void get_colors(int flags, int *fg, int *bg, int *attr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*fg < 0 || *fg > 15)
|
if (*fg < 0 || *fg > 15)
|
||||||
*fg = current_theme->default_color;
|
*fg = -1;
|
||||||
if (*bg < 0 || *bg > 15)
|
if (*bg < 0 || *bg > 15)
|
||||||
*bg = -1;
|
*bg = -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user