fix(tmux): a click in copy-mode returns to the prompt

MouseDown1Pane in copy-mode-vi now cancels the mode instead of only clearing
the selection. Drag-select (root MouseDrag1Pane re-enters copy-mode) and
click-to-switch-pane are unchanged.
This commit is contained in:
bchanot
2026-10-06 15:13:00 +02:00
parent ef418fea04
commit 8ab681627c
+4 -2
View File
@@ -151,10 +151,12 @@ if-shell 'command -v pbcopy >/dev/null' \
bind-key -Tcopy-mode-vi Escape send -X cancel # cancel v mode
bind-key -Tcopy-mode-vi ^v send -X rectangle-toggle # cancel v mode
bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
bind-key -T copy-mode-vi MouseDown1Pane select-pane -t = \; send-keys -X cancel
bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -eM\" \"send-keys -M\"' 'copy-mode -eM'
# (note) {{{
# The `bind-key -T copy-m...` let a single click do selection clearing for us.
# The `bind-key -T copy-m...` makes a single click leave copy-mode: back to
# the prompt, selection dropped. A drag still selects (MouseDrag1Pane below
# re-enters copy-mode) and a click on another pane still switches to it.
# The `bind -n MouseDrag1Pane if -Ft= ...` changes the default binding of
# MouseDrag1Pane, the only difference is that we use `copy-mode -eM` instead
# of `copy-mode -M`, so that WheelDownPane can trigger copy-mode to exit when