feat(web): copy terminal selections automatically #9091
main fromrefs/pull/9091/head·opened View on GitHubShowing 3 changed files with 43 additions and 0 deletions.
🟡 Medium components/ThreadTerminalDrawer.tsx:830
handleMouseUp overwrites the clipboard with the stale terminal selection after scrollbar gestures and DEC mouse-reporting clicks, even though neither gesture creates or completes a text selection. Because selectionGestureActiveRef is set for every left-button pointerdown in mount, gate this copy on an actual canvas selection gesture (excluding the scrollbar and mouse-reporting path).
Also found in 1 other location(s)
apps/web/src/terminal/ghostty/surface.ts:929
copySelectionToClipboardunconditionally copies whatever selection already exists. The drawer invokes it for every left-button gesture begun in the mount, including a click thatonPointerDownroutes 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.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/ThreadTerminalDrawer.tsx around line 830:
`handleMouseUp` overwrites the clipboard with the stale terminal selection after scrollbar gestures and DEC mouse-reporting clicks, even though neither gesture creates or completes a text selection. Because `selectionGestureActiveRef` is set for every left-button `pointerdown` in `mount`, gate this copy on an actual canvas selection gesture (excluding the scrollbar and mouse-reporting path).
Also found in 1 other location(s):
- apps/web/src/terminal/ghostty/surface.ts: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.