feat(clipboard): Ctrl+C copies selection; Ctrl+V pastes into PTY#121
Merged
Conversation
**Terminal (xterm.js):** - Ctrl+C with text selected → copies to clipboard; SIGINT is NOT sent - Ctrl+V → reads clipboard and sends text to PTY; raw 0x16 is NOT sent - Ctrl+Shift+C / Ctrl+Shift+V still work as before (always-copy / always-paste) - textarea execCommand fallback when navigator.clipboard is restricted **Transcript:** - Ctrl+C on selected text → explicit clipboard write; ensures copy works in pywebview EdgeWebView2 even when the native clipboard API is restricted **Tests:** - e2e/tests/feature/clipboard.spec.ts covers transcript Ctrl+C and verifies xterm terminal handler is wired on open Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…rtions - Remove dead `__xtermInstances` check that never ran (xterm doesn't expose this) - Terminal test now verifies canvas renders after "New terminal" click (handler wired) - Second terminal test types a marker, selects via xterm internal API, Ctrl+C, reads clipboard Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ht-tab-new-terminal
Previous run failed:
- transcript: [data-testid^="msg-"] found hover-only copy button → timeout;
fix: use [data-msg-index] which is always present on message divs
- terminal: .xterm-screen canvas not found; fix: use [data-testid^="tile-pane-"]
(proven pattern from close-pane.spec.ts) + page.getByTestId('right-tab-new-terminal')
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Prior specs may leave a terminal tab active, hiding the transcript pane (display:none). Explicitly click right-tab-transcript to make pane visible. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…dText Windows clipboard.readText() returns \r\n even when \n was written. Strip \r before the toBe assertion so the test passes on Windows CI. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ctrl+Cwith text selected → copies to clipboard; SIGINT is not sent.Ctrl+V→ reads clipboard and sends text to PTY; raw0x16is not sent.Ctrl+Chandler ensures copy works in pywebview EdgeWebView2 even when the native clipboard API is restricted.Ctrl+Shift+C/Ctrl+Shift+Vremain available as unconditional copy/paste alternatives.Root cause
xterm.jsroutes all keystrokes to the PTY viaonData.Ctrl+Csent\x03(SIGINT);Ctrl+Vsent\x16. There was no clipboard path. Addedterm.attachCustomKeyEventHandler()which intercepts these two keys with clipboard semantics before they reach the PTY.Files changed
backend/frontend/terminal-pane.jsxattachCustomKeyEventHandlerfor Ctrl+C (copy) + Ctrl+V (paste)backend/frontend/transcript.jsxkeydownhandler;execCommandfallbacke2e/tests/feature/clipboard.spec.tsTest plan
🤖 Generated with Claude Code