From 24c4c047415db25fd266ea8ae5d289e3610828de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 1 Nov 2014 10:23:33 +0100 Subject: [PATCH] core: fix buffer property "lines_hidden" when merging buffers or when a line is removed from a buffer (closes #226) --- ChangeLog.asciidoc | 2 ++ src/gui/gui-line.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 00c1135be..aacef2ee5 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -39,6 +39,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] === Bugs fixed +* core: fix buffer property "lines_hidden" when merging buffers or when a line + is removed from a buffer (closes #226) * core: display time in bare display only if option weechat.look.buffer_time_format is not an empty string * core: fix translation of message displayed after /upgrade diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index 21cf56de6..1ea5948ab 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -947,6 +947,10 @@ gui_line_add_to_list (struct t_gui_lines *lines, if (prefix_length > lines->prefix_max_length) lines->prefix_max_length = prefix_length; + /* adjust "lines_hidden" if the line is hidden */ + if (!line->data->displayed) + (lines->lines_hidden)++; + lines->lines_count++; } @@ -996,6 +1000,10 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer, gui_buffer_ask_chat_refresh (buffer, 1); } + /* adjust "lines_hidden" if the line was hidden */ + if (!line->data->displayed && (lines->lines_hidden > 0)) + (lines->lines_hidden)--; + /* free data */ if (free_data) { @@ -1287,9 +1295,6 @@ gui_line_add (struct t_gui_buffer *buffer, time_t date, } else { - buffer->own_lines->lines_hidden++; - if (buffer->mixed_lines) - buffer->mixed_lines->lines_hidden++; (void) hook_signal_send ("buffer_lines_hidden", WEECHAT_HOOK_SIGNAL_POINTER, buffer); }