fix(tui): improve clipboard copy fallbacks#15963
Conversation
|
Likely duplicate of #15856 — both add native clipboard fallbacks (pbcopy/wl-copy/xclip/xsel) when OSC 52 fails. Please coordinate to avoid merge conflicts. |
|
Thanks — I checked #15856 in detail. This PR is not literally the same patch, but it does overlap in acceptance surface:
So the duplicate concern is understandable because both solve “OSC 52 alone is not enough; use native clipboard helpers too”, and both cover similar backend families ( The main differences in #15963 are:
That said, I agree we should avoid landing two diverging clipboard fallback implementations if the maintainers prefer a unified direction. I’m happy to coordinate and either:
I’ll wait for maintainer preference before pushing further changes here. |
|
Merged via PR #20159 (#20159). Your commit was cherry-picked onto current main with authorship preserved via rebase-merge. Thanks for the fix — |
Summary
/copyto prefer native clipboard writes and show clearer status messagesProblem
In the TUI,
/copycurrently relies on OSC52 for assistant-message copies. That works in some terminals, but it often fails or feels broken in common setups such as Linux/X11, Wayland, Windows, and WSL, especially when terminal clipboard integration is disabled or partial.What changed
writeClipboardText()now tries platform-native backends in order:pbcopypowershell Set-Clipboardpowershell.exe Set-Clipboardwl-copyxclip, thenxsel/copynow:WSL_DISTRO_NAMEVerification
cd ui-tui && npm test -- src/__tests__/clipboard.test.ts src/__tests__/createSlashHandler.test.tscd ui-tui && npm test