diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-11-24 22:41:22 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-03-20 13:07:20 +0100 |
commit | 472eab38e5ce5dfc8d164e3ac688dbea43de271e (patch) | |
tree | 9a8313fd70e0611043e8bfdcef832dad61f78afd /src/gui | |
parent | aa4beb99e8a78de7d79b5cbe371990860746b938 (diff) | |
download | weechat-472eab38e5ce5dfc8d164e3ac688dbea43de271e.zip |
core: Prevent switching to start of visited buffers when jumping to next
If you run /input jump_next_visited_buffer right after switching to a
buffer, weechat changes to the first buffer in the visited buffers list.
That is, it wraps around and goes to the buffer you visited the longest
ago. This patch fixes that.
The reason it happens is that when you switch to a buffer (normally,
i.e. in another way than using jump_previously_visited_buffer/
jump_next_visited_buffer) gui_buffers_visited_index is set to -1 (in
gui_buffer_visited_add). This makes gui_buffer_visited_get_index_next
return 0 because it returns gui_buffers_visited_index + 1, which makes
gui_input_jump_next_visited_buffer jump to the first buffer in the list
of visited buffers.
Fixes #1591
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-buffer.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index a4216d072..bac2c9fe6 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -4257,6 +4257,7 @@ int gui_buffer_visited_get_index_next () { if ((gui_buffers_visited_count < 2) + || (gui_buffers_visited_index < 0) || (gui_buffers_visited_index >= gui_buffers_visited_count - 1)) return -1; |