Skip to content

fix(tui): suppress ClearScreen flicker on session switch (#5441)#5477

Merged
SivanCola merged 2 commits into
esengine:main-v2from
ttmouse:fix/session-switch-flicker-5441
Jun 30, 2026
Merged

fix(tui): suppress ClearScreen flicker on session switch (#5441)#5477
SivanCola merged 2 commits into
esengine:main-v2from
ttmouse:fix/session-switch-flicker-5441

Conversation

@ttmouse

@ttmouse ttmouse commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

修复内容

Fixes #5441 — 切换会话时出现闪烁

根因分析

切换会话时 replayActiveBranch 会完全重建 viewport 内容并强制回到底部,Update 检测到 YOffset 变化后会触发 tea.ClearScreen 全屏清除+重绘,造成一次额外闪烁。同时,切换/恢复/回放会话时本地 planMode 与 controller 的 plan mode 需要同步清理,否则下一轮可能继续以隐藏的 plan mode 发送。

变更说明

  1. replayActiveBranch 中同步重置 TUI 和 controller 两侧的 plan mode。
  2. 新增一次性的 sessionSwitch 标记,仅在真实 transcript rebuild 时抑制 ClearScreen scroll-jump workaround。
  3. replayActiveBranch/clear 的重建路径复用 clearTranscriptDisplay(),避免旧会话的工具输出折叠状态残留。
  4. 保持 /new 追加 banner 的路径不设置 sessionSwitch,普通滚动跳转仍会触发 ClearScreen workaround。
  5. 合入最新 main-v2 并解决 clearTranscriptDisplay() 冲突。

验证

  • go test ./internal/cli/... 通过
  • git diff --check origin/main-v2...HEAD 通过
  • 新增回归覆盖:session switch 只抑制一次 ClearScreen、后续滚动跳转仍清屏、replay 同步清理 TUI/controller plan mode

@github-actions github-actions Bot added tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/cli/branch.go
Comment thread internal/cli/clear_confirm.go Outdated
@ttmouse ttmouse force-pushed the fix/session-switch-flicker-5441 branch from 968e22d to 808e24f Compare June 28, 2026 09:43
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>
@SivanCola SivanCola merged commit e733483 into esengine:main-v2 Jun 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 切换会话出现闪烁

2 participants