fix(frontend): wire clipboard copy/paste in XtermTerminal#306
Draft
neversettle17-101 wants to merge 3 commits into
Draft
fix(frontend): wire clipboard copy/paste in XtermTerminal#306neversettle17-101 wants to merge 3 commits into
neversettle17-101 wants to merge 3 commits into
Conversation
zellij owns SGR mouse tracking and xterm's selection model is canvas-only, so neither the OS Copy command nor plain drag-to-select worked. Intercept Cmd/Ctrl+C to copy the active selection (falling through when nothing is selected so Ctrl+C still sends SIGINT) and Cmd/Ctrl+V to paste explicitly via the clipboard API rather than relying on xterm's native paste event. Fixes #305 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…select text Cmd+C copy appeared to do nothing because hasSelection() was always false on macOS: xterm.js only forces local selection over zellij's SGR mouse tracking on Shift+drag for Windows/Linux — on Mac the override key is Option/Alt, gated behind macOptionClickForcesSelection which defaults to false. Without it there was no way to select text on Mac at all. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…clobber Replace the shared metaKey||ctrlKey copy/paste check with a per-platform chord table (mac/windows/linux), each easy to extend independently. macOS keeps Cmd+C/Cmd+V since Ctrl has no PTY meaning there. Windows/Linux now use Ctrl+Shift+C/V instead of plain Ctrl+C/Ctrl+V, matching GNOME Terminal/Windows Terminal convention — the previous plain-Ctrl+C check would have silently swallowed SIGINT whenever there was a stale selection on those platforms. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
XtermTerminalloaded several xterm.js addons but had no clipboard wiring, so neither the OS Copy command nor plain mouse drag-to-select worked against the zellij-attached PTY (zellij owns SGR mouse tracking, and xterm selection is rendered to canvas, not DOM).attachCustomKeyEventHandlerthat intercepts Cmd/Ctrl+C (copiesterm.getSelection()vianavigator.clipboard.writeTextonly when there's an active selection, otherwise lets the event through so Ctrl+C still sends SIGINT) and Cmd/Ctrl+V (readsnavigator.clipboard.readText()and forwards viaterm.paste, rather than relying on xterm's native DOM paste event).@xterm/xtermAPIs, no@xterm/addon-clipboardneeded.Test plan
pnpm -C frontend typecheckpassespnpm -C frontend test(full renderer suite, including XtermTerminal tests) passes — 140/140Fixes #305
🤖 Generated with Claude Code