fix: centralize OSC 52 clipboard support for SSH sessions #304
+16
−20
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
Clipboard.copy()so all clipboard operations work over SSHapp.tsx,dialog.tsx, andsession/index.tsxResolves anomalyco#2773
Changes
clipboard.tswriteOsc52()with JSDoc, TTY check, tmux/screen passthroughapp.tsxdialog.tsxsession/index.tsxTesting
Verified locally:
Ctrl+X Y)Also submitted as anomalyco/opencode#8974
Greptile Summary
Centralizes OSC 52 escape sequence handling into a single
writeOsc52()function withinClipboard.copy(), eliminating code duplication across three UI components. This ensures consistent clipboard support over SSH connections and in terminal multiplexers.app.tsx,dialog.tsx, andsession/index.tsxwriteOsc52()function with TTY check (process.stdout.isTTY)STYenvironment variable (in addition to existingTMUXsupport)Confidence Score: 5/5
Important Files Changed
writeOsc52()function with TTY check, JSDoc, and tmux/screen supportClipboard.copy()Clipboard.copy()Clipboard.copy()Sequence Diagram
sequenceDiagram participant User participant UI as UI Component participant Clipboard as Clipboard.copy() participant OSC52 as writeOsc52() participant Terminal as Terminal Emulator User->>UI: Select text and trigger copy UI->>Clipboard: Clipboard.copy(text) Clipboard->>OSC52: writeOsc52(text) alt TTY detected alt In tmux or screen OSC52->>Terminal: Write DCS passthrough wrapper else Direct terminal OSC52->>Terminal: Write OSC 52 sequence end Terminal->>Terminal: Set local clipboard else Non-TTY Note over OSC52: Skip OSC 52 output end Clipboard->>Clipboard: Call platform copy method Clipboard-->>UI: Return success or error UI->>User: Show toast notification