diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-buffer.c | 27 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 9e32c7f23..e9fca3933 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -4494,6 +4494,33 @@ gui_buffer_jump_smart (struct t_gui_window *window) } /* + * Jumps to last buffer that is visible (not hidden). + */ + +void +gui_buffer_jump_last_visible_number (struct t_gui_window *window) +{ + struct t_gui_buffer *ptr_buffer; + int number; + + if (!window) + return; + + /* search last non-hidden buffer */ + for (ptr_buffer = last_gui_buffer; ptr_buffer; + ptr_buffer = ptr_buffer->prev_buffer) + { + if (!ptr_buffer->hidden) + break; + } + + number = (ptr_buffer) ? + ptr_buffer->number : ((last_gui_buffer) ? last_gui_buffer->number : -1); + if (number > 0) + gui_buffer_switch_by_number (gui_current_window, number); +} + +/* * Jumps to last buffer displayed (before last jump to a buffer). */ diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 9fc329929..0dc1c3b6b 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -386,6 +386,7 @@ extern struct t_gui_buffer_visited *gui_buffer_visited_add (struct t_gui_buffer extern int gui_buffer_visited_get_index_previous (); extern int gui_buffer_visited_get_index_next (); extern void gui_buffer_jump_smart (struct t_gui_window *window); +extern void gui_buffer_jump_last_visible_number (struct t_gui_window *window); extern void gui_buffer_jump_last_buffer_displayed (struct t_gui_window *window); extern void gui_buffer_jump_previously_visited_buffer (struct t_gui_window *window); extern void gui_buffer_jump_next_visited_buffer (struct t_gui_window *window); |