From f4c01bc78565e53adf9d07c31913a0f380710863 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 17 Nov 2006 22:03:00 +0000 Subject: [PATCH] Added space between chat and nicklist when position is "right" (bug #17852) --- ChangeLog | 1 + src/gui/curses/gui-curses-chat.c | 27 ++++++++++++++++++------ weechat/ChangeLog | 1 + weechat/src/gui/curses/gui-curses-chat.c | 27 ++++++++++++++++++------ 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 035805f60..6475504b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2006-11-17 Version 0.2.2 (under dev!): + * added space between chat and nicklist when position is "right" (bug #17852) * added option "look_nicklist_separator" (task #5437) * fixed bug with DCC SEND when filename begins with '~' * added "irc_send_unknown_commands" option to send unknown commands to diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 03aac8e16..9c71a7aef 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -216,6 +216,20 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase) } } +/* + * gui_chat_get_real_width: return real width: width - 1 if nicklist is at right, + * for good copy/paste (without nicklist separator) + */ + +int +gui_chat_get_real_width (t_gui_window *window) +{ + if (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_RIGHT) + return window->win_chat_width - 1; + else + return window->win_chat_width; +} + /* * gui_chat_display_new_line: display a new line */ @@ -226,7 +240,8 @@ gui_chat_display_new_line (t_gui_window *window, int num_lines, int count, { if ((count == 0) || (*lines_displayed >= num_lines - count)) { - if ((!simulate) && (window->win_chat_cursor_x <= window->win_chat_width - 1)) + if ((!simulate) + && (window->win_chat_cursor_x <= gui_chat_get_real_width (window) - 1)) { wmove (GUI_CURSES(window)->win_chat, window->win_chat_cursor_y, @@ -514,9 +529,9 @@ gui_chat_display_word (t_gui_window *window, chars_to_display = gui_word_strlen (window, data); /* too long for current line */ - if (window->win_chat_cursor_x + chars_to_display > window->win_chat_width) + if (window->win_chat_cursor_x + chars_to_display > gui_chat_get_real_width (window)) { - num_displayed = window->win_chat_width - window->win_chat_cursor_x; + num_displayed = gui_chat_get_real_width (window) - window->win_chat_cursor_x; pos_saved_char = gui_word_real_pos (window, data, num_displayed); saved_char = data[pos_saved_char]; data[pos_saved_char] = '\0'; @@ -541,7 +556,7 @@ gui_chat_display_word (t_gui_window *window, if ((data >= end_line) || (((simulate) || (window->win_chat_cursor_y <= window->win_chat_height - 1)) && - (window->win_chat_cursor_x > (window->win_chat_width - 1)))) + (window->win_chat_cursor_x > (gui_chat_get_real_width (window) - 1)))) gui_chat_display_new_line (window, num_lines, count, lines_displayed, simulate); @@ -685,8 +700,8 @@ gui_chat_display_line (t_gui_window *window, t_gui_line *line, int count, if (word_length > 0) { /* spaces + word too long for current line but ok for next line */ - if ((window->win_chat_cursor_x + word_length_with_spaces > window->win_chat_width) - && (word_length <= window->win_chat_width - line->length_align)) + if ((window->win_chat_cursor_x + word_length_with_spaces > gui_chat_get_real_width (window)) + && (word_length <= gui_chat_get_real_width (window) - line->length_align)) { gui_chat_display_new_line (window, num_lines, count, &lines_displayed, simulate); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 035805f60..6475504b2 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -5,6 +5,7 @@ ChangeLog - 2006-11-17 Version 0.2.2 (under dev!): + * added space between chat and nicklist when position is "right" (bug #17852) * added option "look_nicklist_separator" (task #5437) * fixed bug with DCC SEND when filename begins with '~' * added "irc_send_unknown_commands" option to send unknown commands to diff --git a/weechat/src/gui/curses/gui-curses-chat.c b/weechat/src/gui/curses/gui-curses-chat.c index 03aac8e16..9c71a7aef 100644 --- a/weechat/src/gui/curses/gui-curses-chat.c +++ b/weechat/src/gui/curses/gui-curses-chat.c @@ -216,6 +216,20 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase) } } +/* + * gui_chat_get_real_width: return real width: width - 1 if nicklist is at right, + * for good copy/paste (without nicklist separator) + */ + +int +gui_chat_get_real_width (t_gui_window *window) +{ + if (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_RIGHT) + return window->win_chat_width - 1; + else + return window->win_chat_width; +} + /* * gui_chat_display_new_line: display a new line */ @@ -226,7 +240,8 @@ gui_chat_display_new_line (t_gui_window *window, int num_lines, int count, { if ((count == 0) || (*lines_displayed >= num_lines - count)) { - if ((!simulate) && (window->win_chat_cursor_x <= window->win_chat_width - 1)) + if ((!simulate) + && (window->win_chat_cursor_x <= gui_chat_get_real_width (window) - 1)) { wmove (GUI_CURSES(window)->win_chat, window->win_chat_cursor_y, @@ -514,9 +529,9 @@ gui_chat_display_word (t_gui_window *window, chars_to_display = gui_word_strlen (window, data); /* too long for current line */ - if (window->win_chat_cursor_x + chars_to_display > window->win_chat_width) + if (window->win_chat_cursor_x + chars_to_display > gui_chat_get_real_width (window)) { - num_displayed = window->win_chat_width - window->win_chat_cursor_x; + num_displayed = gui_chat_get_real_width (window) - window->win_chat_cursor_x; pos_saved_char = gui_word_real_pos (window, data, num_displayed); saved_char = data[pos_saved_char]; data[pos_saved_char] = '\0'; @@ -541,7 +556,7 @@ gui_chat_display_word (t_gui_window *window, if ((data >= end_line) || (((simulate) || (window->win_chat_cursor_y <= window->win_chat_height - 1)) && - (window->win_chat_cursor_x > (window->win_chat_width - 1)))) + (window->win_chat_cursor_x > (gui_chat_get_real_width (window) - 1)))) gui_chat_display_new_line (window, num_lines, count, lines_displayed, simulate); @@ -685,8 +700,8 @@ gui_chat_display_line (t_gui_window *window, t_gui_line *line, int count, if (word_length > 0) { /* spaces + word too long for current line but ok for next line */ - if ((window->win_chat_cursor_x + word_length_with_spaces > window->win_chat_width) - && (word_length <= window->win_chat_width - line->length_align)) + if ((window->win_chat_cursor_x + word_length_with_spaces > gui_chat_get_real_width (window)) + && (word_length <= gui_chat_get_real_width (window) - line->length_align)) { gui_chat_display_new_line (window, num_lines, count, &lines_displayed, simulate);