mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
core: fix scroll in buffer after enabling/disabling some filters (if scroll is on a hidden line) (bug #37885)
This commit is contained in:
@@ -7,6 +7,8 @@ v0.4.0-rc1, 2013-01-01
|
||||
Version 0.4.0 (under dev!)
|
||||
--------------------------
|
||||
|
||||
* core: fix scroll in buffer after enabling/disabling some filters (if scroll
|
||||
is on a hidden line) (bug #37885)
|
||||
* core: fix memory leak in case of error when building content of bar item for
|
||||
display
|
||||
* core: fix detection of command in input: a single command char is considered
|
||||
|
||||
+28
-1
@@ -39,6 +39,7 @@
|
||||
#include "gui-filter.h"
|
||||
#include "gui-buffer.h"
|
||||
#include "gui-line.h"
|
||||
#include "gui-window.h"
|
||||
|
||||
|
||||
struct t_gui_filter *gui_filters = NULL; /* first filter */
|
||||
@@ -137,8 +138,10 @@ void
|
||||
gui_filter_buffer (struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_gui_line *ptr_line;
|
||||
int line_displayed, lines_hidden;
|
||||
struct t_gui_window *ptr_window;
|
||||
int lines_changed, line_displayed, lines_hidden;
|
||||
|
||||
lines_changed = 0;
|
||||
lines_hidden = 0;
|
||||
|
||||
buffer->lines->prefix_max_length = CONFIG_INTEGER(config_look_prefix_align_min);
|
||||
@@ -156,7 +159,10 @@ gui_filter_buffer (struct t_gui_buffer *buffer)
|
||||
|
||||
/* force chat refresh if at least one line changed */
|
||||
if (ptr_line->data->displayed != line_displayed)
|
||||
{
|
||||
gui_buffer_ask_chat_refresh (buffer, 2);
|
||||
lines_changed = 1;
|
||||
}
|
||||
|
||||
ptr_line->data->displayed = line_displayed;
|
||||
|
||||
@@ -170,6 +176,27 @@ gui_filter_buffer (struct t_gui_buffer *buffer)
|
||||
hook_signal_send ("buffer_lines_hidden",
|
||||
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* if status of at least one line has changed, check that a scroll in a
|
||||
* window displaying this buffer is not on a hidden line (if this happens,
|
||||
* use the previous displayed line as scroll)
|
||||
*/
|
||||
if (lines_changed)
|
||||
{
|
||||
for (ptr_window = gui_windows; ptr_window;
|
||||
ptr_window = ptr_window->next_window)
|
||||
{
|
||||
if ((ptr_window->buffer == buffer)
|
||||
&& ptr_window->scroll->start_line
|
||||
&& !ptr_window->scroll->start_line->data->displayed)
|
||||
{
|
||||
ptr_window->scroll->start_line =
|
||||
gui_line_get_prev_displayed (ptr_window->scroll->start_line);
|
||||
ptr_window->scroll->start_line_pos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user