Skip to content

fix(tui): session list garbled on arrow-key navigation - #43

Merged
huichen merged 5 commits into
mainfrom
gui-bug-fix
Jul 26, 2026
Merged

huichen merged 5 commits into
mainfrom
gui-bug-fix

Conversation

@huichen

@huichen huichen commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

问题

TUI 中 ctrl+r 打开会话列表后,按上下键整个列表内容错乱(行偏移、内容叠写、底层文字透出)。

根因(3 个渲染 bug)

  1. 覆盖层渲染宽度 ≠ 盒子宽度:compositeOverlays 用全终端宽度渲染组件,但覆盖层布局宽度默认只有 80 列,内容溢出盒子右边界
  2. 光标标记被覆盖层遮挡:extractCursorPosition 在覆盖层合成之后执行,编辑器行的光标标记被 extractSegments 丢弃,cursorPos 为 null,hardwareCursorRow 追踪失准,diff 渲染时行写入位置偏移(表现为 AABD 式错位)
  3. 覆盖层无背景色:底层 chat 文字从覆盖层两侧透出,视觉错乱

修复

  • compositeOverlays 两遍渲染:先测高,再用 layout.width 重渲染
  • doRender:extractCursorPosition 移到覆盖层合成之前
  • SelectList:所有行通过 applyBackgroundToLine 填充背景色,覆盖层成为实心盒子
  • 所有 SelectList 覆盖层传入显式宽度 min(80, cols-4),与模型选择器一致
  • 会话列表/会话树 description 简化为 "current",与模型列表视觉一致
  • 另包含:会话输入草稿缓存、streaming 状态下 activeToolCount/toolStartTime 正确重置(工作区原有改动)

验证

  • tsc --noEmit 通过
  • 160 个 bun 测试全部通过
  • 实机 ctrl+r + 上下键验证正常

huichen added 5 commits July 25, 2026 11:11
Add Windows support for all three profile targets:

- profile-agent / profile-quick: set RUSTFLAGS via cmd syntax;
  fix --config quoting for cmd compatibility; use PowerShell
  scripts with blondie (ETW CPU profiler) fallback
- profile-heap: fix --config quoting; add ;
  use debug=2 on Windows for better backtrace capture

New scripts:
- scripts/agent-profile-bench.ps1: profile-agent runner
  using blondie for CPU flamegraph + gRPC load driving
- scripts/profile-quick.ps1: profile-quick runner with
  blondie fallback (admin required for flamegraph)

Unix/macOS paths are preserved unchanged in ifeq branches.
- compositeOverlays: two-pass render so overlay content is drawn at
  layout.width (was termW), preventing content from spilling out of the
  overlay box and mixing with background text
- doRender: extract cursor position BEFORE overlay compositing so the
  editor cursor marker is never dropped, keeping hardwareCursorRow
  accurate for diff rendering (fixes rows written at wrong offsets)
- SelectList: fill every row with a solid background color via
  applyBackgroundToLine so the overlay forms an opaque box and
  underlying chat text can't bleed through
- SelectList overlays: pass explicit width (min(80, cols-4)) matching
  the model picker
- session list/tree: description shows only 'current' for the active
  session, consistent with the model list
Collapse all whitespace runs (newlines, tabs, multiple spaces) into a
single space and trim leading/trailing whitespace. Session names
derived from multi-line first messages no longer break list layout.
@huichen
huichen merged commit 01309bb into main Jul 26, 2026
16 checks passed
@huichen
huichen deleted the gui-bug-fix branch July 26, 2026 09:46
huichen added a commit that referenced this pull request Sep 4, 2026
future-loop SKILL.md v3.13.0: document per-turn .live.jsonl + transport-error
resume — two observability gotchas that mis-report a live worker as dead.
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.

1 participant