fix(terminal): write PTY output live and de-overlap reattach restores#1527
Open
fix(terminal): write PTY output live and de-overlap reattach restores#1527
Conversation
Eliminates the duplicated-TUI-output and broken-wide-char glyph artifacts that appeared when switching to a worktree after leaving it for a while. Two structural fixes: 1. Single-source restore on reattach. handleReattachResult now enforces strict precedence (snapshot > replay > coldRestore) and paints exactly one source per reattach. Painting both daemon snapshot and relay replay doubled the same lines because their tails overlap. Snapshot/replay still ack any superseded coldRestore so the daemon does not redeliver. 2. Always-live xterm writes. PTY output now flows straight into xterm regardless of pane visibility. The visibility-gated buffer (pendingWritesRef + chunked drain + fit-epoch dedup) was the source of the cursor-on-strange-line and broken-glyph bugs: bytes accumulated while hidden then flushed into xterm at stale cols on resume, before fitAllPanes() could correct the dimensions. The visibility prop now only controls WebGL suspend/resume (GPU resource management). Also adds an inline comment at openTerminal() pinning Unicode 11 activation before any caller-driven write — wide-char widths bake into the buffer at the active unicode version, so writing into a v6-default xterm corrupts CJK/emoji/ZWJ layouts. New regression tests: - snapshot wins over replay when both present - replay wins over coldRestore (and still acks) - Unicode-11 ordering: open → loadAddon:unicode11 → activeVersion=11 → write - live writes regardless of visibility prop Co-authored-by: Orca <help@stably.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eliminates the duplicated-TUI-output and broken-wide-char glyph artifacts that appeared when switching to a worktree after leaving it for a while.
RC build
Pre-built artifacts for testing this PR: v1.3.38-rc.1
Two structural fixes
1. Single-source restore on reattach
handleReattachResultnow enforces strict precedence (snapshot > replay > coldRestore) and paints exactly one source per reattach. Painting both daemon snapshot and relay replay doubled the same lines because their tails overlap. Snapshot/replay still ack any superseded coldRestore so the daemon does not redeliver.2. Always-live xterm writes
PTY output now flows straight into xterm regardless of pane visibility. The visibility-gated buffer (
pendingWritesRef+ chunked drain + fit-epoch dedup) was the source of the cursor-on-strange-line and broken-glyph bugs: bytes accumulated while hidden then flushed into xterm at stale cols on resume, beforefitAllPanes()could correct the dimensions. The visibility prop now only controls WebGL suspend/resume (GPU resource management).Unicode-11 ordering
Adds an inline comment at
openTerminal()pinning Unicode 11 activation before any caller-driven write — wide-char widths bake into the buffer at the active unicode version, so writing into a v6-default xterm corrupts CJK/emoji/ZWJ layouts.New regression tests
open → loadAddon:unicode11 → activeVersion=11 → writeMade with Orca 🐋