What Changed#
Added support to automatically copy selected terminal text into clipboard.
Why#
iterm has this feature. I am completely loving t3 code and it has taken over my whole workflow, but having to select then click to copy text has been a small nit I have missed about my old tmux+iterm workflow.
UI Changes#
Checklist#
Note
Copy terminal selections to clipboard automatically on mouseup in TerminalViewport#
- Adds
copyTerminalSelection utility in surface.ts that primes the hidden input and runs document.execCommand("copy") for non-empty selections; returns false when selection is empty.
- Exposes
copySelectionToClipboard() on GhosttyTerminalSurface delegating to the new utility.
- Calls
terminalRef.current?.copySelectionToClipboard() inside the mouseup handler in ThreadTerminalDrawer.tsx so qualifying selection events copy to clipboard.
- Adds tests in surface.test.ts covering non-empty and empty selection cases.
📊 Macroscope summarized eb0e487. 2 files reviewed, 2 issues evaluated, 1 issue filtered, 1 comment posted
🗂️ Filtered Issues#
apps/web/src/terminal/ghostty/surface.ts — 0 comments posted, 1 evaluated, 1 filtered
- line 929:
copySelectionToClipboard unconditionally copies whatever selection already exists. The drawer invokes it for every left-button gesture begun in the mount, including a click that onPointerDown routes to an application after DEC mouse tracking is enabled. Since that path does not change/clear a pre-existing Ghostty selection, such application clicks silently overwrite the user's clipboard with stale terminal text rather than only copying a completed selection gesture. [ Cross-file consolidated ]
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed