feat(web): copy the terminal selection with ctrl+c - #26
Conversation
…#5638) (cherry picked from commit 1add47b322ab1dfb5010bb363613650176b88088)
Thread transfer impact
This comment will update automatically after the next completed run. |
Browser pass attempted — the change is not verifiable on this hostRan the app on this branch against seeded data, opened the terminal drawer (ghostty canvas and 1. Synthetic key events cannot drive this code path. The implementation deliberately relies on the browser's native 2. More fundamentally: this host is macOS, so the changed line never executes. So the honest position: verifying this needs a Windows or Linux browser. What the pass does establish is narrower but not worthless — the terminal surface still mounts and initialises correctly with the new The reasoning behind the change still reads correctly on inspection: the copy path is gated on |
Adopts upstream
#5638. On non-mac, copying a terminal selection requiredCtrl+Shift+C; plainCtrl+Cnow copies too.The interesting part: this does not break interrupt
Ctrl+Cin a terminal is normally SIGINT, so rebinding it to copy is the kind of change that can quietly ruin your ability to stop a runaway process. I read this one specifically to check, and it's handled:isTerminalCopyShortcut(event) && this.hasSelection(), so with nothing selectedCtrl+Cfalls straight through to the shell as SIGINT.Ctrl+Creaches the shell.clearSelectionAfterCopyis set only for the plain non-mac chord.Cmd+CandCtrl+Shift+Cstay copy-only and keep the selection, since neither is SIGINT.The tradeoff is real and worth stating: with text selected, the first
Ctrl+Ccopies instead of interrupting. The auto-clear keeps that to a single press.The rest is browser-compatibility plumbing: plain
Ctrl+Cisn'tpreventDefaulted so the native copy event still fires, with a token-guarded deferredclipboard.writeTextracing it for WebKit, which omits the keyboard copy event when there's no DOM selection.Ctrl+Shift+Chas no native event at all (Chrome binds it to inspect), so that branch synthesises one viaexecCommand("copy"). There's also acontextMenuFallbackpath and one new IPC contract member.Verification
vp test runover the 3 touched test files: 47 passed.@t3tools/weband@t3tools/contracts: no errors.vp linton the changed files: clean.Clean cherry-pick, no Pylon adaptation needed.
No browser pass. Clipboard behaviour differs across engines and this change leans on those differences deliberately — the WebKit race in particular is the sort of thing unit tests can't settle. Worth a real pass in Chrome and Safari before trusting it fully; say the word and I'll run one.
Model: Claude Opus 5. Harness: Claude Code.
Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.