fix(tmux): drag in a mouse app (claude, vim) died with "syntax error"

The MouseDrag1Pane binding escaped the inner quotes as \" inside a
single-quoted string. Since tmux 3.0 the backslashes are literal there,
so the branch taken when the pane has mouse tracking on failed to parse:
no selection, "syntax error" in the status line. Plain-shell panes never
hit that branch, which is why only claude/vim panes were affected.
This commit is contained in:
bchanot
2026-10-06 18:02:47 +02:00
parent 773e1c5fa6
commit 31f8400852
+3 -1
View File
@@ -166,7 +166,7 @@ bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
bind-key -T copy-mode-vi MouseDown1Pane select-pane -t = \; send-keys -X clear-selection
bind-key -T copy-mode-vi MouseUp1Pane 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'
bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= "#{pane_in_mode}" "copy-mode -eM" "send-keys -M"' 'copy-mode -eM'
# (note) {{{
# A plain click (MouseDown then MouseUp, no drag) leaves copy-mode: back to
# the prompt, selection dropped. A drag sends MouseDrag/MouseDragEnd instead
@@ -176,6 +176,8 @@ bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\"
# 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
# copy-mode is entered by MouseDrag1Pane
# Inner quotes stay plain: `\"` is literal inside '...' since tmux 3.0, and the
# mouse-app branch (claude, vim) then dies with "syntax error" on every drag.
# }}}
bind-key k "split-window -v -b -c '#{pane_current_path}'"