fix(terminal): use ClipboardAddon for copy-on-select - #264
Merged
Conversation
copyOnSelect option was removed in xterm.js v5. The correct replacement is @xterm/addon-clipboard which handles clipboard integration via the Clipboard API. Adds the addon to both the interactive terminal and the read-only output panel. Co-authored-by: Mistaber Code <code@mistaber.ai>
There was a problem hiding this comment.
Pull request overview
Verdict: CHANGES REQUESTED
Counts: [CRITICAL] 2 · [IMPORTANT] 0 · [NIT] 0
Scope detected: platform
Highlights:
ClipboardAddondoes not implement copy-on-select by itself, so the intended UX change won’t work inTerminal.tsx.- Same issue in
OutputPanel.tsx; selection still won’t auto-copy without an explicit selection handler.
This PR aims to restore “copy selected terminal text to clipboard” behavior after copyOnSelect was removed/ignored in newer xterm.js, by adding @xterm/addon-clipboard and wiring it into the interactive terminal and output panel.
Changes:
- Add
@xterm/addon-clipboarddependency. - Load
ClipboardAddoninTerminal.tsxandOutputPanel.tsxafter removing the deprecatedcopyOnSelectoption.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dashboard/frontend/src/components/Terminal/Terminal.tsx | Removes deprecated copyOnSelect and loads ClipboardAddon in the interactive terminal. |
| dashboard/frontend/src/components/BottomPanel/OutputPanel.tsx | Same migration for the read-only output terminal. |
| dashboard/frontend/package.json | Adds @xterm/addon-clipboard dependency. |
| dashboard/frontend/package-lock.json | Updates lockfile for the new dependency (and associated metadata normalization). |
Files not reviewed (1)
- dashboard/frontend/package-lock.json: Language not supported
Comment on lines
117
to
+120
| const fitAddon = new FitAddon(); | ||
| term.loadAddon(fitAddon); | ||
| term.loadAddon(new WebLinksAddon()); | ||
| term.loadAddon(new ClipboardAddon()); |
Comment on lines
125
to
128
| const fitAddon = new FitAddon(); | ||
| term.loadAddon(fitAddon); | ||
| term.loadAddon(new ClipboardAddon()); | ||
| term.loadAddon(new WebLinksAddon()); |
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
@xterm/addon-clipboardcopyOnSelect: trueoption withClipboardAddoninTerminal.tsxandOutputPanel.tsxRoot cause
copyOnSelectwas removed in xterm.js v5 (@xterm/xterm). The option is silently ignored — that's why the previous PR #263 had no effect. The correct API is@xterm/addon-clipboardwhich uses the browser Clipboard API.Test plan
Generated by Mistaber Code — Computational Halacha Encoding Agent