summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-07-20 11:31:48 +0200
committerSebastien Helleu <flashcode@flashtux.org>2013-07-20 11:31:48 +0200
commit27882ee74e7f77e143ae0df2656ae3b845aff5cd (patch)
tree12a69f2c40318361a2cc8b9aae71e4f7685289cf /src/gui
parent354d96ea36e8a1c08a9d5def076a752b75098f17 (diff)
downloadweechat-27882ee74e7f77e143ae0df2656ae3b845aff5cd.zip
core: scroll to bottom after smart jump (alt-a) only if window was scrolled (and not beyond the end)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-input.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 73158b737..831482134 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -1261,7 +1261,9 @@ void
gui_input_jump_smart (struct t_gui_buffer *buffer)
{
struct t_gui_window *window;
+ int scroll_to_bottom;
+ scroll_to_bottom = 0;
window = gui_window_search_with_buffer (buffer);
if (window
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
@@ -1272,7 +1274,7 @@ gui_input_jump_smart (struct t_gui_buffer *buffer)
gui_hotlist_initial_buffer = window->buffer;
gui_window_switch_to_buffer (window, gui_hotlist->buffer, 1);
gui_hotlist_remove_buffer (window->buffer);
- gui_window_scroll_bottom (window);
+ scroll_to_bottom = 1;
}
else
{
@@ -1282,7 +1284,7 @@ gui_input_jump_smart (struct t_gui_buffer *buffer)
{
gui_window_switch_to_buffer (window,
gui_hotlist_initial_buffer, 1);
- gui_window_scroll_bottom (window);
+ scroll_to_bottom = 1;
}
gui_hotlist_initial_buffer = NULL;
}
@@ -1291,6 +1293,18 @@ gui_input_jump_smart (struct t_gui_buffer *buffer)
gui_hotlist_initial_buffer = NULL;
}
}
+
+ /*
+ * scroll to bottom if window was scrolled (except if scrolled
+ * beyond the end)
+ */
+ if (scroll_to_bottom
+ && window->scroll
+ && window->scroll->start_line
+ && (window->scroll->start_line_pos >= 0))
+ {
+ gui_window_scroll_bottom (window);
+ }
}
}