mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #546] [MERGED] feat(clipboard): add OSC 52 clipboard support for SSH/remote sessions #610
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#610
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/546
Author: @Son0fSun
Created: 1/17/2026
Status: ✅ Merged
Merged: 1/31/2026
Merged by: @kommander
Base:
main← Head:main📝 Commits (10+)
8e9b138feat(clipboard): add OSC 52 clipboard support for SSH/remote sessions115c632Merge branch 'main' into main9f8d859wip56a07adrefactor2b21a8cfactor to renderer private4524c4duse enumd10a011stash wip937f5bccleanupf0538e3coveraged61085cMerge branch 'main' into main📊 Changes
13 files changed (+727 additions, -68 deletions)
View changed files
📝
packages/core/src/examples/console-demo.ts(+8 -9)➕
packages/core/src/lib/clipboard.test.ts(+100 -0)➕
packages/core/src/lib/clipboard.ts(+43 -0)📝
packages/core/src/renderer.ts(+25 -1)📝
packages/core/src/testing/test-renderer.ts(+4 -1)📝
packages/core/src/zig-structs.ts(+1 -0)📝
packages/core/src/zig.ts(+16 -4)📝
packages/core/src/zig/ansi.zig(+4 -0)📝
packages/core/src/zig/lib.zig(+16 -2)📝
packages/core/src/zig/renderer.zig(+19 -1)📝
packages/core/src/zig/terminal.zig(+211 -50)📝
packages/core/src/zig/tests/terminal_test.zig(+221 -0)➕
packages/core/src/zig/tests/test_utils.zig(+59 -0)📄 Description
Summary
pbcopyin console-demo with portable OSC 52Problem
Clipboard operations don't work when running OpenTUI applications over SSH because the app doesn't have access to the local clipboard. This breaks copy/paste workflows for remote development.
Fixes https://github.com/sst/opencode/issues/6111
Fixes https://github.com/anomalyco/opencode/issues/2773
Solution
OSC 52 is an ANSI escape sequence that allows terminal applications to interact with the system clipboard through the terminal emulator. The terminal handles the clipboard operation locally, so it works seamlessly over SSH.
New API
Supported Environments
Technical Details
OSC 52 format:
ESC ] 52 ; <target> ; <base64-content> STFor terminal multiplexers, the sequence must be wrapped in DCS passthrough:
ESC P tmux; ESC ESC <seq> ESC \ESC P ESC ESC <seq> ESC \Changes
packages/core/src/lib/clipboard.tspackages/core/src/lib/clipboard.test.tspackages/core/src/lib/index.tspackages/core/src/examples/console-demo.tsTest plan
bun test packages/core/src/lib/clipboard.test.ts)🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.