1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

core: fix display of background color in chat area after line feed

This commit is contained in:
Sebastien Helleu
2011-10-02 10:58:10 +02:00
parent f89cecf71d
commit cf598e8447
4 changed files with 52 additions and 18 deletions
+2 -1
View File
@@ -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)
+4
View File
@@ -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);
+44 -17
View File
@@ -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,11 +198,37 @@ 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))
{
+2
View File
@@ -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,