From 2087d8e1143d33ea8e5c88715978f10e0ca0eba5 Mon Sep 17 00:00:00 2001 From: Kate Chapman Date: Sun, 5 Apr 2026 09:06:59 -0700 Subject: [PATCH] feat: improve terminal text selection with persistent highlight and click bindings Change tmux copy-mode mouse bindings from copy-pipe-and-cancel to copy-pipe-no-clear so selections stay visible after release. Add double-click (select word) and triple-click (select line) bindings that enter copy mode, select, and copy to clipboard via pbcopy. Co-Authored-By: Claude Opus 4.6 (1M context) --- Sources/Terminal/TerminalSurface.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Terminal/TerminalSurface.swift b/Sources/Terminal/TerminalSurface.swift index f2a2b10..f9b2206 100644 --- a/Sources/Terminal/TerminalSurface.swift +++ b/Sources/Terminal/TerminalSurface.swift @@ -298,8 +298,10 @@ class TerminalSurface: NSObject, LocalProcessTerminalViewDelegate { set -g history-limit 50000 set -s set-clipboard on set -s extended-keys on - bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel pbcopy - bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel pbcopy + bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-no-clear pbcopy + bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear pbcopy + bind-key -T root DoubleClick1Pane select-pane -t = \\; if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" "send-keys -M" "copy-mode -H; send-keys -X select-word; send-keys -X copy-pipe-no-clear pbcopy" + bind-key -T root TripleClick1Pane select-pane -t = \\; if -F "#{||:#{pane_in_mode},#{mouse_any_flag}}" "send-keys -M" "copy-mode -H; send-keys -X select-line; send-keys -X copy-pipe-no-clear pbcopy" """ /// Apply tmux options (from UserDefaults or defaults) to a session.