mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-17 19:59:33 +01:00
fix(terminal): strip OSC 52 from replays and copy each clipboard write once
xterm parses write() data after chunkedTerminalWrite has already cleared _isLoadingBuffer, so the main terminal's replay gate never held: a tab switch or reconnect re-copied the newest OSC 52 in the replayed history. Strip every OSC 52 from the replay beside the DEC 2026 markers (OSC52_STRIP_RE). Tiles keep their own _bufferLoading gate, which holds there. One Claude Code copy arrives up to three times (its own OSC 52, tmux load-buffer -w, set-clipboard forwarding), so identical text within OSC52_DEDUPE_MS is dropped. The manual-copy fallback opens only in the focused tab, so a background tab on the same session stays quiet. The replay tests now drive the real chunkedTerminalWrite into @xterm/headless and fail without the strip. Test harnesses that supply DEC_SYNC_STRIP_RE by hand get OSC52_STRIP_RE too, and CLAUDE.md records the rules next to Auto Copy.
This commit is contained in:
1 parent
435a56be10
commit
4ecf7fa228
11 files changed
+127
-29
No files matched your search
@@ -1507,6 +1507,14 @@ function scheduleBackground(fn) {
|
||||
// but server-sent terminal buffers may still contain markers from Claude CLI.
|
||||
const DEC_SYNC_STRIP_RE = /\x1b\[\?2026[hl]/g;
|
||||
|
||||
// OSC 52 clipboard writes stripping — a replay re-feeds the raw byte history, and
|
||||
// xterm parses it after chunkedTerminalWrite has already released the load
|
||||
// gate, so an OSC 52 left in would re-copy old text on every tab switch.
|
||||
const OSC52_STRIP_RE = /\x1b\]52;[^\x07\x1b]*(?:\x07|\x1b\\)/g;
|
||||
// The same OSC 52 text arriving again within this window is one copy delivered
|
||||
// several ways (direct, tmux load-buffer -w, tmux set-clipboard forwarding).
|
||||
const OSC52_DEDUPE_MS = 1000;
|
||||
|
||||
// Built-in respawn configuration presets
|
||||
const BUILTIN_RESPAWN_PRESETS = [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user