From a1bc5ce60ffabe0b697e53f1bb82f3ccfbaa3302 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 5 Dec 2006 14:27:01 +0000 Subject: [PATCH] Fixed display bug with color for first line on screen (bug #17719) --- ChangeLog | 3 ++- src/gui/curses/gui-curses-chat.c | 33 +++++++++++++++--------- weechat/ChangeLog | 3 ++- weechat/src/gui/curses/gui-curses-chat.c | 33 +++++++++++++++--------- 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index be26d835c..3d5a68097 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-12-04 +ChangeLog - 2006-12-05 Version 0.2.2 (under dev!): + * fixed display bug with color for first line on screen (bug #17719) * added anti-flood option (irc_anti_flood) (task #5442) * fixed bug with "set_config" function in plugins API (bug #18448) * plugins: "add_message_handler" now accepts "*" for all IRC messages diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 7c70b5854..2ad35842d 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -478,13 +478,14 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string, */ void -gui_chat_display_word_raw (t_gui_window *window, char *string) +gui_chat_display_word_raw (t_gui_window *window, char *string, int display) { char *prev_char, *next_char, saved_char, *output; - - wmove (GUI_CURSES(window)->win_chat, - window->win_chat_cursor_y, - window->win_chat_cursor_x); + + if (display) + wmove (GUI_CURSES(window)->win_chat, + window->win_chat_cursor_y, + window->win_chat_cursor_x); while (string && string[0]) { @@ -493,7 +494,7 @@ gui_chat_display_word_raw (t_gui_window *window, char *string) return; prev_char = utf8_prev_char (string, next_char); - if (prev_char) + if (display && prev_char) { saved_char = next_char[0]; next_char[0] = '\0'; @@ -572,18 +573,26 @@ gui_chat_display_word (t_gui_window *window, pos_saved_char = gui_word_real_pos (window, data, num_displayed); saved_char = data[pos_saved_char]; data[pos_saved_char] = '\0'; - if ((!simulate) && - ((count == 0) || (*lines_displayed >= num_lines - count))) - gui_chat_display_word_raw (window, data); + if (!simulate) + { + if ((count == 0) || (*lines_displayed >= num_lines - count)) + gui_chat_display_word_raw (window, data, 1); + else + gui_chat_display_word_raw (window, data, 0); + } data[pos_saved_char] = saved_char; data += pos_saved_char; } else { num_displayed = chars_to_display; - if ((!simulate) && - ((count == 0) || (*lines_displayed >= num_lines - count))) - gui_chat_display_word_raw (window, data); + if (!simulate) + { + if ((count == 0) || (*lines_displayed >= num_lines - count)) + gui_chat_display_word_raw (window, data, 1); + else + gui_chat_display_word_raw (window, data, 0); + } data += strlen (data); } diff --git a/weechat/ChangeLog b/weechat/ChangeLog index be26d835c..3d5a68097 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-12-04 +ChangeLog - 2006-12-05 Version 0.2.2 (under dev!): + * fixed display bug with color for first line on screen (bug #17719) * added anti-flood option (irc_anti_flood) (task #5442) * fixed bug with "set_config" function in plugins API (bug #18448) * plugins: "add_message_handler" now accepts "*" for all IRC messages diff --git a/weechat/src/gui/curses/gui-curses-chat.c b/weechat/src/gui/curses/gui-curses-chat.c index 7c70b5854..2ad35842d 100644 --- a/weechat/src/gui/curses/gui-curses-chat.c +++ b/weechat/src/gui/curses/gui-curses-chat.c @@ -478,13 +478,14 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string, */ void -gui_chat_display_word_raw (t_gui_window *window, char *string) +gui_chat_display_word_raw (t_gui_window *window, char *string, int display) { char *prev_char, *next_char, saved_char, *output; - - wmove (GUI_CURSES(window)->win_chat, - window->win_chat_cursor_y, - window->win_chat_cursor_x); + + if (display) + wmove (GUI_CURSES(window)->win_chat, + window->win_chat_cursor_y, + window->win_chat_cursor_x); while (string && string[0]) { @@ -493,7 +494,7 @@ gui_chat_display_word_raw (t_gui_window *window, char *string) return; prev_char = utf8_prev_char (string, next_char); - if (prev_char) + if (display && prev_char) { saved_char = next_char[0]; next_char[0] = '\0'; @@ -572,18 +573,26 @@ gui_chat_display_word (t_gui_window *window, pos_saved_char = gui_word_real_pos (window, data, num_displayed); saved_char = data[pos_saved_char]; data[pos_saved_char] = '\0'; - if ((!simulate) && - ((count == 0) || (*lines_displayed >= num_lines - count))) - gui_chat_display_word_raw (window, data); + if (!simulate) + { + if ((count == 0) || (*lines_displayed >= num_lines - count)) + gui_chat_display_word_raw (window, data, 1); + else + gui_chat_display_word_raw (window, data, 0); + } data[pos_saved_char] = saved_char; data += pos_saved_char; } else { num_displayed = chars_to_display; - if ((!simulate) && - ((count == 0) || (*lines_displayed >= num_lines - count))) - gui_chat_display_word_raw (window, data); + if (!simulate) + { + if ((count == 0) || (*lines_displayed >= num_lines - count)) + gui_chat_display_word_raw (window, data, 1); + else + gui_chat_display_word_raw (window, data, 0); + } data += strlen (data); }