Uh oh!
There was an error while loading. Please reload this page.
fix(web): copy terminal selection with Ctrl+Insert - #8541
Conversation
Shift+Insert already pastes. Ctrl+Insert currently falls through because isTerminalCopyShortcut only matches the C key.
Mirror the Shift+Insert paste branch. Ctrl+Insert is the GTK/VTE copy chord and the one tiling WMs send for universal clipboard on a terminal window. Copy only, do not treat it as SIGINT. Closespingdotgg#8525
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped terminal shortcut fix: non-macOS Ctrl+Insert now copies an existing selection through the established copy path, while existing shortcuts and macOS behavior remain unchanged. Regression tests cover the new and excluded cases, with no schema, infrastructure, or sensitive-area changes. You can add or adjust custom eligibility rules. Learn more. |
What Changed
isTerminalCopyShortcutnow treatsCtrl+Insertas copy on non-mac platforms, matching the existingShift+Insertpaste branch. The keydown handler copies withexecCommand("copy")the same way it does forCtrl+Shift+C, so the chord does not go to the PTY and is not treated as SIGINT.Why
Tiling WMs such as Omarchy map universal copy on a terminal window to
Ctrl+Insert. Paste already worked because #5982 addedShift+Insert. Copy still requiredkey === "c", so the selection never reached the clipboard.Ctrl+Insertis also the usual GTK/VTE copy chord.Closes#8525
Blast Radius
Web and desktop share
GhosttyTerminalSurface. Mobile does not use this helper.Ctrl+CandCtrl+Shift+Care unchanged. macOS still ignores Insert for this shortcut.Verification
Failing-then-passing regression in
apps/web/src/terminal/ghostty/surface.test.ts.vp test run apps/web/src/terminal/ghostty/surface.test.tsfailed withexpected false to be trueonCtrl+Insert.vp linton the two changed files: 0 errors.vp run --filter @t3tools/web typecheck: clean.No UI chrome changed, so no screenshots.
Checklist
Note
Low Risk
Scoped keyboard shortcut and clipboard copy path in the Ghostty terminal surface; existing Ctrl+C and macOS behavior stay unchanged.
Overview
Non-mac Ghostty terminal copy now treats Ctrl+Insert like other copy chords when text is selected, alongside existing Ctrl+C / Cmd+C behavior.
isTerminalCopyShortcutadds an Insert branch (Ctrl, no Shift/Meta) on non-mac platforms, mirroring how Shift+Insert is handled for paste. The surface keydown path runsexecCommand("copy")for Insert as well as Ctrl+Shift+C, because the browser does not fire a native copy event for those chords—so the selection is primed and copied without sending the key to the PTY or triggering SIGINT semantics tied to plain Ctrl+C.Regression tests cover Linux acceptance and macOS rejection of Ctrl+Insert.
Reviewed by Cursor Bugbot for commit c9b54bb. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add
Ctrl+Insertcopy shortcut to terminal on non-mac platformsisTerminalCopyShortcutin surface.ts to return true for theInsertkey on non-mac platforms whenCtrlis pressed and neitherShiftnorMetaare held.keydownhandler soCtrl+Inserttriggers the synthesized copy path (document.execCommand('copy')) and callspreventDefault, matching the existingCtrl+Shift+Cbehavior.Ctrl+Insert, andShift+Insert/Meta+Insertare not treated as copy on any platform.Macroscope summarized c9b54bb.