From 3a6c717bb81ee5b219d56e2250ad563ce1523025 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 9 Jul 2026 07:54:07 +0000 Subject: [PATCH] Do not exit at bottom if a selection is in progress, GitHub issue 5349 from xiaomublue at gmail dot com. --- tmux.1 | 4 +++- window-copy.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tmux.1 b/tmux.1 index dbfb7a30a..50d398b7c 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2340,7 +2340,8 @@ but also exit copy mode if the cursor reaches the bottom. .It Xo .Ic scroll\-exit\-on .Xc -Turn on exiting copy mode when scrolling to the end of the buffer. +Turn on exiting copy mode when scrolling to the end of the buffer, unless a +selection is present. .It Xo .Ic scroll\-exit\-off .Xc @@ -2617,6 +2618,7 @@ instead of .Fl e specifies that scrolling to the bottom of the history (to the visible screen) should exit copy mode. +This will not happen if a selection is present. While in copy mode, pressing a key other than those used for scrolling will disable this behaviour. This is intended to allow fast scrolling through a pane's history, for diff --git a/window-copy.c b/window-copy.c index aedbba99b..33743cea3 100644 --- a/window-copy.c +++ b/window-copy.c @@ -854,7 +854,7 @@ window_copy_scroll1(struct window_mode_entry *wme, struct window_pane *wp, window_copy_cursor_end_of_line(wme); } - if (scroll_exit && data->oy == 0) { + if (scroll_exit && data->oy == 0 && data->screen.sel == NULL) { window_pane_reset_mode(wp); return; } @@ -972,7 +972,7 @@ window_copy_pagedown1(struct window_mode_entry *wme, int half_page, window_copy_cursor_end_of_line(wme); } - if (scroll_exit && data->oy == 0) + if (scroll_exit && data->oy == 0 && data->screen.sel == NULL) return (1); if (data->searchmark != NULL && !data->timeout) window_copy_search_marks(wme, NULL, data->searchregex, 1); @@ -2352,7 +2352,7 @@ window_copy_cmd_scroll_down(struct window_copy_cmd_state *cs) for (; np != 0; np--) window_copy_cursor_down(wme, 1); - if (data->scroll_exit && data->oy == 0) + if (data->scroll_exit && data->oy == 0 && data->screen.sel == NULL) return (WINDOW_COPY_CMD_CANCEL); return (WINDOW_COPY_CMD_NOTHING); }