Repository navigation
Commit 8a1ce2e
fix(clipboard): improve OSC 52 escape sequence for SSH compatibility
Fix clipboard operations not working over SSH by improving the OSC 52
escape sequence implementation with proper terminal multiplexer support.
## Problems Fixed
1. **BEL vs ST terminator**: Changed from BEL (\x07) to ST (\x1b\\)
for better compatibility. Some terminals don't handle BEL correctly
inside DCS passthrough sequences.
2. **GNU Screen passthrough**: Fixed incorrect format - Screen uses
DCS without the `tmux;` prefix that was being applied to both.
- Before: `\x1bPtmux;\x1b<seq>\x1b\\` (wrong for Screen)
- After: `\x1bP<seq>\x1b\\` (correct for Screen)
3. **Nested tmux sessions**: Added detection of tmux nesting level
via comma count in TMUX env var, doubling escapes for each level.
## Technical Details
OSC 52 format: ESC ] 52 ; c ; <base64> ST
Passthrough wrapping:
- tmux: `ESC P tmux; ESC ESC <seq> ESC \`
- screen: `ESC P ESC ESC <seq> ESC \`
The escape characters must be doubled inside DCS sequences so they
pass through to the outer terminal emulator.
## Supported Terminals
- iTerm2, Kitty, Alacritty, Windows Terminal
- tmux (including nested sessions)
- GNU Screen
- Most modern terminal emulators
Fixes: anomalyco#6111
Fixes: anomalyco#2773
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 759ce8f commit 8a1ce2e
1 file changed
Lines changed: 37 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| 21 | + | |
15 | 22 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 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 | + | |
20 | 53 | | |
21 | 54 | | |
22 | 55 | | |
| |||
0 commit comments