summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-10-02 10:58:10 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-10-02 10:58:10 +0200
commitcf598e8447755b0e5d2c16d3f67112f7b292ef61 (patch)
tree685ecc6be9eb4d33649ebd525407bc51ed530c99
parentcore: add missing hook type "focus" in array "hook_type_string" (fix crash when calling infolist_get with bad hook type) (diff)
downloadweechat-cf598e8447755b0e5d2c16d3f67112f7b292ef61.tar.xz
weechat-cf598e8447755b0e5d2c16d3f67112f7b292ef61.zip
core: fix display of background color in chat area after line feed
-rw-r--r--ChangeLog3
-rw-r--r--src/gui/curses/gui-curses-chat.c4
-rw-r--r--src/gui/curses/gui-curses-window.c61
-rw-r--r--src/gui/gui-window.h2
4 files changed, 52 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index a122decdc..9e203ccf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.3.6-dev, 2011-09-30
+v0.3.6-dev, 2011-10-02
Version 0.3.6 (under dev!)
--------------------------
+* core: fix display of background color in chat area after line feed
* core: fix paste detection (problem with end of lines)
* core: add new option weechat.look.color_basic_force_bold, off by default: bold
is used only if terminal has less than 16 colors (patch #7621)
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index f54b31e11..736f3e137 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -439,6 +439,7 @@ gui_chat_display_word (struct t_gui_window *window,
ptr_pair = &pair;
wattr_get (GUI_WINDOW_OBJECTS(window)->win_chat,
ptr_attrs, ptr_pair, NULL);
+ gui_window_save_style ();
gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_chat,
GUI_COLOR_CHAT_PREFIX_SUFFIX);
gui_chat_display_word_raw (window, line,
@@ -453,7 +454,10 @@ gui_chat_display_word (struct t_gui_window *window,
}
window->win_chat_cursor_x += gui_chat_strlen_screen (str_space);
if (!simulate)
+ {
wattr_set (GUI_WINDOW_OBJECTS(window)->win_chat, attrs, pair, NULL);
+ gui_window_restore_style ();
+ }
}
if (window->win_chat_cursor_y < window->coords_size)
window->coords[window->win_chat_cursor_y].data = (char *)word + (ptr_data - data);
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index b4a88bb89..eae461294 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -57,10 +57,11 @@
#include "gui-curses.h"
-int window_current_style_fg; /* current foreground color */
-int window_current_style_bg; /* current background color */
-int window_current_style_attr; /* current attributes (bold, ..) */
-int window_current_color_attr; /* attr sum of last color(s) used */
+int gui_window_current_style_fg; /* current foreground color */
+int gui_window_current_style_bg; /* current background color */
+int gui_window_current_style_attr; /* current attributes (bold, ..) */
+int gui_window_current_color_attr; /* attr sum of last color(s) used */
+int gui_window_saved_style[4]; /* current style saved */
/*
@@ -197,12 +198,38 @@ void
gui_window_clrtoeol (WINDOW *window)
{
wbkgdset (window,
- ' ' | COLOR_PAIR (gui_color_get_pair (window_current_style_fg,
- window_current_style_bg)));
+ ' ' | COLOR_PAIR (gui_color_get_pair (gui_window_current_style_fg,
+ gui_window_current_style_bg)));
wclrtoeol (window);
}
/*
+ * gui_window_save_style: save current style
+ */
+
+void
+gui_window_save_style ()
+{
+ gui_window_saved_style[0] = gui_window_current_style_fg;
+ gui_window_saved_style[1] = gui_window_current_style_bg;
+ gui_window_saved_style[2] = gui_window_current_style_attr;
+ gui_window_saved_style[3] = gui_window_current_color_attr;
+}
+
+/*
+ * gui_window_restore_style: restore style values
+ */
+
+void
+gui_window_restore_style ()
+{
+ gui_window_current_style_fg = gui_window_saved_style[0];
+ gui_window_current_style_bg = gui_window_saved_style[1];
+ gui_window_current_style_attr = gui_window_saved_style[2];
+ gui_window_current_color_attr = gui_window_saved_style[3];
+}
+
+/*
* gui_window_reset_style: reset style (color and attr) with a weechat color
* for a window
*/
@@ -210,10 +237,10 @@ gui_window_clrtoeol (WINDOW *window)
void
gui_window_reset_style (WINDOW *window, int weechat_color)
{
- window_current_style_fg = -1;
- window_current_style_bg = -1;
- window_current_style_attr = 0;
- window_current_color_attr = 0;
+ gui_window_current_style_fg = -1;
+ gui_window_current_style_bg = -1;
+ gui_window_current_style_attr = 0;
+ gui_window_current_color_attr = 0;
wattroff (window, A_BOLD | A_UNDERLINE | A_REVERSE);
wattron (window, COLOR_PAIR(gui_color_weechat_get_pair (weechat_color)) |
@@ -227,7 +254,7 @@ gui_window_reset_style (WINDOW *window, int weechat_color)
void
gui_window_set_color_style (WINDOW *window, int style)
{
- window_current_color_attr |= style;
+ gui_window_current_color_attr |= style;
wattron (window, style);
}
@@ -238,7 +265,7 @@ gui_window_set_color_style (WINDOW *window, int style)
void
gui_window_remove_color_style (WINDOW *window, int style)
{
- window_current_color_attr &= !style;
+ gui_window_current_color_attr &= !style;
wattroff (window, style);
}
@@ -249,8 +276,8 @@ gui_window_remove_color_style (WINDOW *window, int style)
void
gui_window_set_color (WINDOW *window, int fg, int bg)
{
- window_current_style_fg = fg;
- window_current_style_bg = bg;
+ gui_window_current_style_fg = fg;
+ gui_window_current_style_bg = bg;
wattron (window, COLOR_PAIR(gui_color_get_pair (fg, bg)));
}
@@ -300,7 +327,7 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
if (fg >= 0)
{
- current_bg = window_current_style_bg;
+ current_bg = gui_window_current_style_bg;
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
{
@@ -362,8 +389,8 @@ gui_window_set_custom_color_bg (WINDOW *window, int bg)
if (bg >= 0)
{
- current_attr = window_current_style_attr;
- current_fg = window_current_style_fg;
+ current_attr = gui_window_current_style_attr;
+ current_fg = gui_window_current_style_fg;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
{
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index a81371662..f91403fdd 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -207,6 +207,8 @@ extern int gui_window_get_height ();
extern int gui_window_objects_init (struct t_gui_window *window);
extern void gui_window_objects_free (struct t_gui_window *window,
int free_separator);
+extern void gui_window_save_style ();
+extern void gui_window_restore_style ();
extern void gui_window_calculate_pos_size (struct t_gui_window *window);
extern void gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer,