fix(tui): suppress ClearScreen flicker on session switch (#5441)#5477
Merged
SivanCola merged 2 commits intoJun 30, 2026
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 968e22dd0a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ual transcript rebuild
968e22d to
808e24f
Compare
Resolve the clear transcript helper conflict and add focused regression coverage for session-switch ClearScreen suppression. Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
Closed
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 #5441 — 切换会话时出现闪烁
根因分析
切换会话时
replayActiveBranch会完全重建 viewport 内容并强制回到底部,Update检测到YOffset变化后会触发tea.ClearScreen全屏清除+重绘,造成一次额外闪烁。同时,切换/恢复/回放会话时本地planMode与 controller 的 plan mode 需要同步清理,否则下一轮可能继续以隐藏的 plan mode 发送。变更说明
replayActiveBranch中同步重置 TUI 和 controller 两侧的 plan mode。sessionSwitch标记,仅在真实 transcript rebuild 时抑制ClearScreenscroll-jump workaround。replayActiveBranch和/clear的重建路径复用clearTranscriptDisplay(),避免旧会话的工具输出折叠状态残留。/new追加 banner 的路径不设置sessionSwitch,普通滚动跳转仍会触发 ClearScreen workaround。main-v2并解决clearTranscriptDisplay()冲突。验证
go test ./internal/cli/...通过git diff --check origin/main-v2...HEAD通过