Repository navigation
Commit 02b0311
fix(web): terminal OSC 52 copies reach the client clipboard (#1790)
## Problem
Copying out of a tmux or zmux terminal in T3 never reaches the client clipboard: drag-select and copy-mode `y` both fail.
tmux copies by writing OSC 52 to each client, but libghostty-vt has no clipboard callback, so the web terminal drops it.
Closes #1789
- [ ] Live OSC 52 writes from a terminal land in the focused client's clipboard
- [ ] Replayed history never rewrites the clipboard, and OSC 52 read queries get no reply
## Change
`osc52Clipboard.fork.ts` scans live terminal output for OSC 52 and calls `navigator.clipboard.writeText`.
- **Terminators:** BEL and ST
- **Split chunks:** buffered, 1 MiB cap
- **Reset replay:** clears state, never copies
- **`?` read query:** ignored, never answered
- **Shared sessions:** focused viewer only
`ThreadTerminalDrawer.tsx` gains two `zmux-estate/osc52-clipboard` fork-hook lines.
Retire when upstream `pingdotgg#8361` lands.
## Scope and approval
Fork bugfix for #1789.
Desktop inherits it through the web app; the native mobile terminal is untouched.
## Verification
Dev app in the T3 Browser panel, a throwaway tmux server with `set-clipboard on`, and a spy on `navigator.clipboard.writeText`.
**Before** (hook reverted): copy-mode selection, then `y`: no clipboard write.

**After:** copy-mode selection, then `y`: `writeText("yanked-from-tmux-copy-mode")` resolves.

The clipboard is not visible on screen; the spy output is the proof.
- [x] Direct `printf` OSC 52: copied
- [x] tmux copy-mode `y`: copied
- [x] tmux mouse drag-select: copied
- [x] Drag without focus: write refused, swallowed
- [x] Hook reverted, same `y`: no write
- [x] `vp test run` osc52 test → exit 0
- [x] `vp run typecheck` (apps/web) → exit 0
- [x] `vp run fork:ci` → exit 0
- [ ] Not checked: desktop clipboard readback
The Browser panel has its own clipboard, so the desktop clipboard was not read back.
Claude Opus 5.5 via Claude Code in T3 Code.
## Fork trailers
Squashes:
- d17fee7 fix(web): terminal OSC 52 copies reach the client clipboard (#1790) (#1790)
- 7b801e6 fixup! fix(web): terminal OSC 52 copies reach the client clipboard (#1790) (#1790)
Fork-Domain: zmux-estate
Fork-Tier: bugfix
Fork-Upstreamable: yes
Co-authored-by: donjor <[email protected]>1 parent 850335e commit 02b0311
3 files changed
Lines changed: 133 additions & 1 deletion
File tree
- apps/web/src
- components
- terminal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| 245 | + | |
244 | 246 | | |
245 | 247 | | |
246 | 248 | | |
| |||
730 | 732 | | |
731 | 733 | | |
732 | 734 | | |
733 | | - | |
| 735 | + | |
734 | 736 | | |
735 | 737 | | |
736 | 738 | | |
| |||
765 | 767 | | |
766 | 768 | | |
767 | 769 | | |
| 770 | + | |
768 | 771 | | |
769 | 772 | | |
770 | 773 | | |
| |||
775 | 778 | | |
776 | 779 | | |
777 | 780 | | |
| 781 | + | |
| 782 | + | |
778 | 783 | | |
779 | 784 | | |
780 | 785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
0 commit comments