Repository navigation
fix(terminal): repaint full-screen programs after a replay - #18
Merged
Merged
Conversation
Full-screen TUIs such as Claude Code send cell diffs against what they drew earlier. Once their last full paint left the 512 KB replay ring, a reattach (page reload, the Mac app reloading after its web process dies, the backpressure resync) rebuilt a mostly blank screen, and the same-size resize sent on attach is no signal, so nothing repaired it. After such a replay the PTY is one row shorter for 150 ms, which makes the program repaint. Real Claude Code with only diffs in the ring (32 KB for the run): 0 of 30 rows restored before, 30 of 30 and identical after. WebKit has no contextlost/contextrestored events, so pixels discarded in the background would stay blank now that unchanged rows are skipped. Terminals repaint in full on window focus and when the page becomes visible; that loss itself was not reproduced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Resizing or writing to a killed session threw "Terminal is closed" while the shell was still dying; a throw in a WebSocket handler or timer exits the server and every terminal with it. - sendReplay uses the exact ringTrimmed flag instead of guessing from the byte count, which cut the first line of complete replays. - A reattach at a new size relies on that resize, with no nudge on top. - Coming back to the window restores the canvas settings as well as the pixels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
dash leaves the cursor after its prompt, so on a fresh alternate screen the marker is indented and the prompt-aware line() helper never matched it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A long Claude Code session could come back blank or with only a few rows.
Cause. Full-screen TUIs send cell diffs against what they drew earlier. Once their last full paint has left the 512 KB replay ring, a reattach (page reload, the Mac app reloading after its web process dies, the backpressure resync) rebuilds a mostly blank screen. The same-size resize sent on attach is no signal, so nothing repaired it.
Fix.
contextlost/contextrestored. This is a precaution: that loss was not reproduced.Found in review and fixed. Resizing or writing to a killed session threw and could exit the whole server (the resize path predates this PR);
sendReplaycut the first line of complete replays; a reattach at a new size was nudged needlessly.Not covered. Inline TUIs on the normal screen (Claude Code's classic renderer) and programs that ignore SIGWINCH. A program stalled past 150 ms sees no change. The missing title bar buttons are a separate issue, still not reproduced.
DESIGN.mdround 12 has the details.🤖 Generated with Claude Code