From 422958337bebfd89a4635cea549bc55f488ab113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 22 Jun 2015 20:09:52 +0200 Subject: [PATCH] core: fix bar item "scroll" after /buffer clear (closes #448) --- ChangeLog.asciidoc | 1 + src/gui/gui-buffer.c | 13 ------------- src/gui/gui-line.c | 12 +++++++++++- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 49978e92c..972a10636 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -28,6 +28,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] === Bugs fixed +* core: fix bar item "scroll" after /buffer clear (closes #448) * core: fix display of time in bare display when option weechat.look.buffer_time_format is set to empty string (closes #441) * fifo: fix send error on Cygwin when something is received in the pipe diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 33a86d6e0..3ff61f171 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -2461,25 +2461,12 @@ gui_buffer_is_scrolled (struct t_gui_buffer *buffer) void gui_buffer_clear (struct t_gui_buffer *buffer) { - struct t_gui_window *ptr_win; - if (!buffer) return; /* remove all lines */ gui_line_free_all (buffer); - /* remove any scroll for buffer */ - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - if (ptr_win->buffer == buffer) - { - ptr_win->scroll->first_line_displayed = 1; - ptr_win->scroll->start_line = NULL; - ptr_win->scroll->start_line_pos = 0; - } - } - gui_hotlist_remove_buffer (buffer, 0); gui_buffer_ask_chat_refresh (buffer, 2); diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c index d37d64ddb..73a8a28b9 100644 --- a/src/gui/gui-line.c +++ b/src/gui/gui-line.c @@ -978,7 +978,17 @@ gui_line_remove_from_list (struct t_gui_buffer *buffer, { ptr_scroll->start_line = ptr_scroll->start_line->next_line; ptr_scroll->start_line_pos = 0; - gui_buffer_ask_chat_refresh (buffer, 2); + if (ptr_scroll->start_line) + { + gui_buffer_ask_chat_refresh (buffer, 2); + } + else + { + ptr_scroll->first_line_displayed = 1; + ptr_scroll->scrolling = 0; + ptr_scroll->lines_after = 0; + gui_window_ask_refresh (1); + } } } /* remove line from coords */