Skip to content

fix(tui): throttle sidebar refresh to eliminate ANSI artifacts during streaming#467

Open
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-423-ansi-sidebar-leak
Open

fix(tui): throttle sidebar refresh to eliminate ANSI artifacts during streaming#467
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-423-ansi-sidebar-leak

Conversation

@Kailigithub
Copy link
Copy Markdown
Contributor

During streaming output, 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 — 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 screen
diff 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

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: ANSI转义序列片段在流式输出时泄漏到主体与侧栏之间的分隔区域

1 participant