From 4732feb33e939b94eb6502d173af7376642c5fc9 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Thu, 12 Mar 2026 13:05:10 -0700 Subject: [PATCH] Add Ctrl+Shift+C keyboard shortcut for copying terminal text Ctrl+C in the terminal sends SIGINT which cancels running Claude work. This adds a custom key handler so Ctrl+Shift+C copies selected text to the clipboard without interrupting the container. Co-Authored-By: Claude Opus 4.6 --- app/src/components/terminal/TerminalView.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/components/terminal/TerminalView.tsx b/app/src/components/terminal/TerminalView.tsx index 22258a7..a4102fc 100644 --- a/app/src/components/terminal/TerminalView.tsx +++ b/app/src/components/terminal/TerminalView.tsx @@ -80,6 +80,22 @@ export default function TerminalView({ sessionId, active }: Props) { term.open(containerRef.current); + // Ctrl+Shift+C copies selected terminal text to clipboard. + // This prevents the keystroke from reaching the container (where + // Ctrl+C would send SIGINT and cancel running work). + term.attachCustomKeyEventHandler((event) => { + if (event.type === "keydown" && event.ctrlKey && event.shiftKey && event.key === "C") { + const sel = term.getSelection(); + if (sel) { + navigator.clipboard.writeText(sel).catch((e) => + console.error("Ctrl+Shift+C clipboard write failed:", e), + ); + } + return false; // prevent xterm from processing this key + } + return true; + }); + // WebGL addon is loaded/disposed dynamically in the active effect // to avoid exhausting the browser's limited WebGL context pool.