diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2014-03-17 08:32:18 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2014-03-17 08:32:18 +0100 |
commit | db852a3f26ad5427b74776cdd994a9280844408e (patch) | |
tree | 2e4ee0d53603c23c9367999ef9f09e6e74cea784 | |
parent | 1a4c68a3d37fe2d471bb7e36137e262c38a5c00c (diff) | |
download | weechat-db852a3f26ad5427b74776cdd994a9280844408e.zip |
core: fix "/window scroll_bottom" on a buffer with free content
The bug was introduced by commit 8fac1eea40d6306c27bd854f8ae7bd0c35632fc9
which purpose was to not scroll to the end of buffer with "/window scroll -N"
when the top of buffer is displayed.
This commit is adding the syntax "--N" to force a scroll from the end (only
used by "/window scroll_bottom").
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 2 | ||||
-rw-r--r-- | src/gui/gui-window.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index b30c2e796..eb9929b32 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -1576,7 +1576,7 @@ gui_window_scroll_bottom (struct t_gui_window *window) window->scroll->start_line = NULL; if (window->buffer->lines->lines_count > window->win_chat_height) { - snprintf (scroll, sizeof (scroll), "-%d", + snprintf (scroll, sizeof (scroll), "--%d", window->win_chat_height - 1); gui_window_scroll (window, scroll); } diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 143720f44..edc4defd9 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -1088,7 +1088,7 @@ gui_window_switch_by_buffer (struct t_gui_window *window, int buffer_number) void gui_window_scroll (struct t_gui_window *window, char *scroll) { - int direction, stop, count_msg; + int direction, stop, count_msg, scroll_from_end_free_buffer; char time_letter, saved_char; time_t old_date, diff_date; char *pos, *error; @@ -1102,12 +1102,18 @@ gui_window_scroll (struct t_gui_window *window, char *scroll) direction = 1; number = 0; time_letter = ' '; + scroll_from_end_free_buffer = 0; /* search direction */ if (scroll[0] == '-') { direction = -1; scroll++; + if (scroll[0] == '-') + { + scroll_from_end_free_buffer = 1; + scroll++; + } } else if (scroll[0] == '+') { @@ -1155,8 +1161,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll) * it's not possible to scroll before first line of buffer on a buffer * with free content */ - if (!window->scroll->start_line - && (window->buffer->type == GUI_BUFFER_TYPE_FREE)) + if (!scroll_from_end_free_buffer && !window->scroll->start_line + && (window->buffer->type == GUI_BUFFER_TYPE_FREE)) return; ptr_line = (window->scroll->start_line) ? window->scroll->start_line : window->buffer->lines->last_line; |