summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-02-05 12:29:42 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-02-05 12:29:42 +0100
commit8ec4e680c6d31e40246efaf5d31238c842ed5098 (patch)
treed0bb6c2d19089e06fe5d2888da0f381ae9590a83
parentf2be50f4b192bca95be061d9ac540f31758466b3 (diff)
downloadweechat-8ec4e680c6d31e40246efaf5d31238c842ed5098.zip
Fix option color_real_white: replace white by default color only if bold is set for color
-rw-r--r--src/gui/curses/gui-curses-color.c4
-rw-r--r--src/gui/curses/gui-curses-window.c47
2 files changed, 41 insertions, 10 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index b0b57f3f6..5bf16eb49 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -319,10 +319,6 @@ gui_color_get_pair (int fg, int bg)
if (bg > gui_color_term_colors)
bg = -1;
- /* if not real white, we use default terminal foreground instead of white */
- if ((fg == COLOR_WHITE) && !CONFIG_BOOLEAN(config_look_color_real_white))
- fg = -1;
-
/* compute index for gui_color_pairs with foreground and background */
index = ((bg + 1) * (gui_color_term_colors + 2)) + (fg + 1);
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 0162d2b99..ed5fcd71d 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -293,6 +293,17 @@ gui_window_set_weechat_color (WINDOW *window, int num_color)
wattron (window, gui_color[num_color]->attributes);
fg = gui_color[num_color]->foreground;
bg = gui_color[num_color]->background;
+
+ /*
+ * if not real white, we use default terminal foreground instead of
+ * white if bold attribute is set
+ */
+ if ((fg == COLOR_WHITE) && (gui_color[num_color]->attributes & A_BOLD)
+ && !CONFIG_BOOLEAN(config_look_color_real_white))
+ {
+ fg = -1;
+ }
+
if ((fg > 0) && (fg & GUI_COLOR_PAIR_FLAG))
fg &= GUI_COLOR_PAIR_MASK;
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
@@ -309,6 +320,8 @@ gui_window_set_weechat_color (WINDOW *window, int num_color)
void
gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
{
+ int attributes;
+
if ((fg >= 0) && (bg >= 0))
{
gui_window_remove_color_style (window, A_BOLD);
@@ -317,8 +330,19 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
fg &= GUI_COLOR_PAIR_MASK;
else
{
- wattron (window, gui_weechat_colors[fg].attributes);
+ attributes = gui_weechat_colors[fg].attributes;
+ wattron (window, attributes);
fg = gui_weechat_colors[fg].foreground;
+
+ /*
+ * if not real white, we use default terminal foreground instead of
+ * white if bold attribute is set
+ */
+ if ((fg == COLOR_WHITE) && (attributes & A_BOLD)
+ && !CONFIG_BOOLEAN(config_look_color_real_white))
+ {
+ fg = -1;
+ }
}
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
@@ -341,7 +365,7 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
void
gui_window_set_custom_color_fg (WINDOW *window, int fg)
{
- int current_bg;
+ int current_bg, attributes;
if (fg >= 0)
{
@@ -354,10 +378,21 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
else if (fg < GUI_CURSES_NUM_WEECHAT_COLORS)
{
gui_window_remove_color_style (window, A_BOLD);
- gui_window_set_color_style (window, gui_weechat_colors[fg].attributes);
- gui_window_set_color (window,
- gui_weechat_colors[fg].foreground,
- current_bg);
+ attributes = gui_weechat_colors[fg].attributes;
+ gui_window_set_color_style (window, attributes);
+ fg = gui_weechat_colors[fg].foreground;
+
+ /*
+ * if not real white, we use default terminal foreground instead of
+ * white if bold attribute is set
+ */
+ if ((fg == COLOR_WHITE) && (attributes & A_BOLD)
+ && !CONFIG_BOOLEAN(config_look_color_real_white))
+ {
+ fg = -1;
+ }
+
+ gui_window_set_color (window, fg, current_bg);
}
}
}