From d8d0d6e4c646a38cf2bbb320eb1dc98afd464c73 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 22 Aug 2012 14:07:01 +0200 Subject: [PATCH] core: display spaces at the end of messages in chat area (bug #37024) --- ChangeLog | 1 + src/gui/curses/gui-curses-chat.c | 9 ++++++++- src/gui/gui-chat.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 52eb2e2e7..7e7be5f71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ v0.3.9-dev, 2012-08-22 Version 0.3.9 (under dev!) -------------------------- +* core: display spaces at the end of messages in chat area (bug #37024) * core: fix infinite loop in display when chat area has width of 1 with a bar displayed on the right (nicklist by default) (bug #37089) * core: fix display of "bar more down" char when text is truncated by size_max diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index f911e57ad..ada131177 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -1119,15 +1119,22 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, ptr_end_offset = ptr_data + word_end_offset; + /* if message ends with spaces, display them */ + if ((word_length == 0) && (word_length_with_spaces > 0) + && !ptr_data[word_end_offset + 1]) + { + word_length = word_length_with_spaces; + } + if (word_length > 0) { - /* spaces + word too long for current line but ok for next line */ line_align = gui_line_get_align (window->buffer, line, 1, (lines_displayed == 0) ? 1 : 0, GUI_WINDOW_OBJECTS(window)->force_prefix_for_line); 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_align)) { + /* spaces + word too long for current line but ok for next line */ gui_chat_display_new_line (window, num_lines, count, &lines_displayed, simulate); /* apply styles before jumping to start of word */ diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 949990f04..6c6b1eeee 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -306,7 +306,10 @@ gui_chat_get_word_info (struct t_gui_window *window, else { if (leading_spaces) + { (*word_length_with_spaces)++; + *word_end_offset = next_char2 - start_data - 1; + } else { *word_end_offset = next_char - start_data - 1;