Replay <Static> output when resume re-enters the alternate screen - #1012
Merged
sindresorhus merged 2 commits intoSep 21, 2026
Merged
sindresorhus merged 2 commits into
sindresorhus merged 2 commits into
Conversation
Collaborator
|
There are two rendering modes this currently gets wrong. With debug: true, the forced redraw already writes fullStaticOutput + output. Replaying fullStaticOutput when re-entering means every static row is written twice. With isScreenReaderEnabled: true, fullStaticOutput is never populated because the screen-reader branch returns before the alternate-screen accumulation. I manually reproduced only live after resume, so the original bug still exists in that mode. |
…er modes The debug redraw already writes fullStaticOutput with every frame, so replaying it when re-entering the alternate screen wrote every static row twice. The screen-reader branch returned before the alternate-screen accumulation, so fullStaticOutput stayed empty there and nothing came back after resume. Accumulate in that branch and skip the replay in debug mode.
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.
Fixes #1011. Follow-up to #1005.
endSuspendre-enters the alternate screen and forces a redraw, but the redraw only carries<Static>items new to that frame, so everything rendered before the suspension stays gone until the next full clear. This writes the accumulated static output right afterenterAlternativeScreen, the same replay the full-clear path already does on the alternate screen, so the frame lands below the restored rows. The primary screen is unchanged: its static rows survive in scrollback and are never replayed.One test, for standard and incremental rendering:
alternateScreen: true, three static items, one live line, 5 rows, a no-opsuspendTerminal(); the terminal reconstructed from the secondenterAlternativeScreenon must readS1, S2, S3, live. Fails on master withlivealone.