fix(tui): native clipboard fallback for /copy command (salvage #15963)#20159
Merged
Conversation
This was referenced May 5, 2026
This was referenced May 24, 2026
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
/copy <n>on assistant messages now hits the system clipboard on GNOME Terminal / Wayland / X11 / WSL / Windows instead of silently emitting an OSC52 that VTE-based terminals don't honor.Changes
ui-tui/src/lib/clipboard.ts: extendwriteClipboardText()beyond macOS-only — now tries pbcopy / powershell / powershell.exe (WSL) / wl-copy / xclip / xsel before returning false. Aligns WSL detection (WSL_INTEROPorWSL_DISTRO_NAME) on read + write paths.ui-tui/src/app/slash/commands/core.ts:/copy <n>now trieswriteClipboardText()first, falls back towriteOsc52Clipboard()only if no native backend worked, and reports honest status.ui-tui/src/__tests__/clipboard.test.ts: coverage for each backend + fallback chain.Validation
npm test -- src/__tests__/clipboard.test.ts src/__tests__/createSlashHandler.test.ts— 66/66 passing.terminalSetup.test.tsfailures on main are unrelated (verified on cleanorigin/main).Salvage of #15963 by @bjianhang onto current main. Closes #18308.