Let Ctrl+V reach the agent on macOS, and leave Cmd+V to the webview's own paste

AI Assisted
This commit is contained in:
Seth committed 2026-12-05 00:10:45 -08:00
1 parent b629f5ef04
commit 91479b21a1
3 files changed
+36 -3

No files matched your search

+5 -2
View File
@@ -774,7 +774,10 @@ export function shortcutFromMessage(data) {
* What a key press does in the terminal's clipboard handling: "copy" (Ctrl+Shift+C, Cmd+C, and
* Ctrl+C while text is selected, the Windows Terminal rule: with nothing selected Ctrl+C is the
* interrupt and returns null), "paste" (Ctrl+V, Ctrl+Shift+V, Cmd+V), or null. With `mac`, a plain
* Ctrl+C is always the interrupt, as in every macOS terminal: copy there is Cmd+C.
* Ctrl+C is always the interrupt, as in every macOS terminal: copy there is Cmd+C. Ctrl+V belongs to
* the agent there too (Claude Code pastes an image with it), and Cmd+V returns null as well: it is
* left to the webview's own paste event, which xterm takes as one paste, because reading the
* clipboard from script makes WebKit ask with a Paste menu before the text arrives.
*/
export function clipboardAction(event, hasSelection, { mac = false } = {}) {
if (!event || event.altKey) return null;
@@ -784,7 +787,7 @@ export function clipboardAction(event, hasSelection, { mac = false } = {}) {
if (event.ctrlKey && !event.metaKey) return event.shiftKey || (hasSelection && !mac) ? 'copy' : null;
return null;
}
if (key === 'v' && (event.ctrlKey || event.metaKey)) return 'paste';
if (key === 'v' && !mac && (event.ctrlKey || event.metaKey)) return 'paste';
return null;
}