fix(tui): throttle sidebar refresh to eliminate ANSI artifacts during streaming#467
Open
Kailigithub wants to merge 1 commit into
Open
fix(tui): throttle sidebar refresh to eliminate ANSI artifacts during streaming#467Kailigithub wants to merge 1 commit into
Kailigithub wants to merge 1 commit into
Conversation
…reaming During streaming, every token chunk triggered a full sidebar refresh via _refresh_sidebar(). The rapid re-renders caused transient ANSI escape sequence fragments to appear in the gap between the main content and sidebar. Throttle sidebar refresh to at most once per second. The sidebar content (session list, status) rarely changes during streaming, so this has no visible impact on content freshness while eliminating the rendering artifacts. Closes lsdefine#423
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.
During streaming output, every token chunk triggered a full sidebar
refresh via
_refresh_sidebar(). The rapid re-renders caused transientANSI escape sequence fragments to appear in the gap between the main
content and sidebar — visible as random digits/characters flickering
in the border region.
Root cause: The sidebar is re-rendered on every streaming chunk,
but its content (session list, status) barely changes during streaming.
The rapid successive
Static.update()calls cause Textual's screendiff algorithm to emit ANSI positioning/SGR sequences that transiently
leak into the adjacent gap cells.
Fix: Throttle
_refresh_sidebar()to at most once per second.This has no visible impact on content freshness (sidebar content is
stable during streaming) while eliminating the rendering artifacts.
Closes #423