core: apply color attributes when clearing a window (patch #8236) (patch from Tom Alsberg)
This commit is contained in:
parent
ea9d79f268
commit
70ed2a8189
1
AUTHORS
1
AUTHORS
@ -68,6 +68,7 @@ Alphabetically:
|
||||
* Simon Kuhnle
|
||||
* Stefano Pigozzi
|
||||
* Stfn
|
||||
* Tom Alsberg
|
||||
* Tor Hveem (xt)
|
||||
* Valentin Lorentz (progval)
|
||||
* Voroskoi
|
||||
|
@ -11,6 +11,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
|
||||
== Version 0.4.3 (under dev)
|
||||
|
||||
* core: apply color attributes when clearing a window (patch #8236)
|
||||
* core: set option weechat.look.paste_bracketed to "on" by default
|
||||
* core: fix truncated text when pasting several long lines (bug #40210)
|
||||
* core: rename option weechat.look.set_title to weechat.look.window_title,
|
||||
|
@ -133,6 +133,29 @@ gui_color_search (const char *color_name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Curses attributes corresponding to extended attributes flags in a color.
|
||||
*/
|
||||
|
||||
int
|
||||
gui_color_get_extended_attrs (int color)
|
||||
{
|
||||
int attributes;
|
||||
|
||||
attributes = 0;
|
||||
|
||||
if (color & GUI_COLOR_EXTENDED_BOLD_FLAG)
|
||||
attributes |= A_BOLD;
|
||||
if (color & GUI_COLOR_EXTENDED_REVERSE_FLAG)
|
||||
attributes |= A_REVERSE;
|
||||
if (color & GUI_COLOR_EXTENDED_ITALIC_FLAG)
|
||||
attributes |= A_ITALIC;
|
||||
if (color & GUI_COLOR_EXTENDED_UNDERLINE_FLAG)
|
||||
attributes |= A_UNDERLINE;
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigns a WeeChat color (read from configuration).
|
||||
*
|
||||
@ -511,14 +534,7 @@ gui_color_build (int number, int foreground, int background)
|
||||
gui_color[number]->foreground = gui_weechat_colors[foreground & GUI_COLOR_EXTENDED_MASK].foreground;
|
||||
gui_color[number]->attributes = gui_weechat_colors[foreground & GUI_COLOR_EXTENDED_MASK].attributes;
|
||||
}
|
||||
if (foreground & GUI_COLOR_EXTENDED_BOLD_FLAG)
|
||||
gui_color[number]->attributes |= A_BOLD;
|
||||
if (foreground & GUI_COLOR_EXTENDED_REVERSE_FLAG)
|
||||
gui_color[number]->attributes |= A_REVERSE;
|
||||
if (foreground & GUI_COLOR_EXTENDED_ITALIC_FLAG)
|
||||
gui_color[number]->attributes |= A_ITALIC;
|
||||
if (foreground & GUI_COLOR_EXTENDED_UNDERLINE_FLAG)
|
||||
gui_color[number]->attributes |= A_UNDERLINE;
|
||||
gui_color[number]->attributes |= gui_color_get_extended_attrs (foreground);
|
||||
|
||||
/* set background */
|
||||
if (background & GUI_COLOR_EXTENDED_FLAG)
|
||||
|
@ -176,7 +176,8 @@ gui_window_clear_weechat (WINDOW *window, int weechat_color)
|
||||
if (!gui_init_ok)
|
||||
return;
|
||||
|
||||
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_weechat_get_pair (weechat_color)));
|
||||
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_weechat_get_pair (weechat_color)) |
|
||||
gui_color[weechat_color]->attributes);
|
||||
werase (window);
|
||||
wmove (window, 0, 0);
|
||||
}
|
||||
@ -188,9 +189,13 @@ gui_window_clear_weechat (WINDOW *window, int weechat_color)
|
||||
void
|
||||
gui_window_clear (WINDOW *window, int fg, int bg)
|
||||
{
|
||||
int attrs;
|
||||
|
||||
if (!gui_init_ok)
|
||||
return;
|
||||
|
||||
attrs = gui_color_get_extended_attrs (fg);
|
||||
|
||||
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
|
||||
fg &= GUI_COLOR_EXTENDED_MASK;
|
||||
else
|
||||
@ -201,7 +206,7 @@ gui_window_clear (WINDOW *window, int fg, int bg)
|
||||
else
|
||||
bg = gui_weechat_colors[bg & GUI_COLOR_EXTENDED_MASK].background;
|
||||
|
||||
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_get_pair (fg, bg)));
|
||||
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_get_pair (fg, bg)) | attrs);
|
||||
werase (window);
|
||||
wmove (window, 0, 0);
|
||||
}
|
||||
@ -413,16 +418,8 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
|
||||
{
|
||||
if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
|
||||
gui_window_remove_color_style (window, A_ALL_ATTR);
|
||||
attributes = 0;
|
||||
if (fg & GUI_COLOR_EXTENDED_BOLD_FLAG)
|
||||
attributes |= A_BOLD;
|
||||
if (fg & GUI_COLOR_EXTENDED_REVERSE_FLAG)
|
||||
attributes |= A_REVERSE;
|
||||
if (fg & GUI_COLOR_EXTENDED_ITALIC_FLAG)
|
||||
attributes |= A_ITALIC;
|
||||
if (fg & GUI_COLOR_EXTENDED_UNDERLINE_FLAG)
|
||||
attributes |= A_UNDERLINE;
|
||||
attributes |= gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].attributes;
|
||||
attributes = gui_color_get_extended_attrs (fg) |
|
||||
gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].attributes;
|
||||
gui_window_set_color_style (window, attributes);
|
||||
fg = gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].foreground;
|
||||
|
||||
@ -505,16 +502,8 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
|
||||
{
|
||||
if (!(fg & GUI_COLOR_EXTENDED_KEEPATTR_FLAG))
|
||||
gui_window_remove_color_style (window, A_ALL_ATTR);
|
||||
attributes = 0;
|
||||
if (fg & GUI_COLOR_EXTENDED_BOLD_FLAG)
|
||||
attributes |= A_BOLD;
|
||||
if (fg & GUI_COLOR_EXTENDED_REVERSE_FLAG)
|
||||
attributes |= A_REVERSE;
|
||||
if (fg & GUI_COLOR_EXTENDED_ITALIC_FLAG)
|
||||
attributes |= A_ITALIC;
|
||||
if (fg & GUI_COLOR_EXTENDED_UNDERLINE_FLAG)
|
||||
attributes |= A_UNDERLINE;
|
||||
attributes |= gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].attributes;
|
||||
attributes = gui_color_get_extended_attrs (fg) |
|
||||
gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].attributes;
|
||||
gui_window_set_color_style (window, attributes);
|
||||
fg = gui_weechat_colors[fg & GUI_COLOR_EXTENDED_MASK].foreground;
|
||||
|
||||
|
@ -85,6 +85,7 @@ extern int gui_color_buffer_refresh_needed;
|
||||
extern int gui_window_current_emphasis;
|
||||
|
||||
/* color functions */
|
||||
extern int gui_color_get_extended_attrs (int color);
|
||||
extern int gui_color_get_pair (int fg, int bg);
|
||||
extern int gui_color_weechat_get_pair (int weechat_color);
|
||||
extern void gui_color_pre_init ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user