Skip to content

fix(tui): complete phased TUI updates (#266)#286

Merged
phantom5099 merged 5 commits into
1024XEngineer:mainfrom
creatang:codex/issue-266-header-render-fix
Apr 14, 2026
Merged

fix(tui): complete phased TUI updates (#266)#286
phantom5099 merged 5 commits into
1024XEngineer:mainfrom
creatang:codex/issue-266-header-render-fix

Conversation

@creatang

Copy link
Copy Markdown
Collaborator

背景

本 PR 汇总了本轮 TUI 分阶段改造(Phase 1~4)以及后续修复,目标是解决 #266 中提到的可用性问题,尤其是:

#266
Issue: #266 (comment)

主要改动

  • Phase 1(布局重构)
  • Phase 2(Header 极简化)
  • Phase 3(输入区底部固定)
  • Phase 4(消息样式重构)
  • 回归修复:
    • 统一 header 渲染与布局高度(headerBarHeight=2
    • header 改为稳定纯文本拼接,避免终端将 ANSI 片段当文本显示
    • 运行中 Thinking... 提示移到正文区域,减少 header 污染
    • 修复用户消息 [ YOU ] 标签与正文右对齐边界不一致问题

影响文件

  • internal/tui/core/app/view.go
  • internal/tui/core/app/styles.go
  • internal/tui/core/app/app.go
  • internal/tui/core/app/view_test.go

测试

已通过:

go test ./internal/tui/core/app ./internal/tui/...

@codecov

codecov Bot commented Apr 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.05085% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/tui/core/app/view.go 57.89% 13 Missing and 3 partials ⚠️
internal/tui/core/app/update.go 81.81% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@creatang

Copy link
Copy Markdown
Collaborator Author

/review

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the TUI simplification changes. I found two regressions worth fixing.

promptHeight := lipgloss.Height(a.renderPrompt(width))
transcriptHeight := max(6, height-activityHeight-menuHeight-promptHeight)
return transcriptHeight, activityHeight, menuHeight, promptHeight
transcriptHeight := max(6, height-activityHeight-menuHeight)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

waterfallMetrics no longer reserves vertical space for the prompt (and it also does not account for the optional Thinking... row), but renderWaterfall still appends those blocks later. This can make rendered content taller than the placed container, causing clipping and desync with hit-testing/layout math (inputBounds/activityBounds). Please keep metrics and rendered sections in sync from a single height model.

copyButtons := make([]copyCodeButtonBinding, 0, 4)
nextCopyID := 1
for _, message := range a.activeMessages {
if message.Role == roleTool {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This skips all roleTool messages during transcript rebuild, and renderMessageBlockWithCopy now also returns early for tool messages. That removes tool output/failure visibility from the transcript, which is a behavior regression for debugging and auditability. If this is intentional, consider keeping at least a compact tool summary or a feature flag.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Focused review findings on functional regressions introduced in this PR.

@@ -470,30 +406,11 @@ func (a App) computeLayout() layout {
helpHeight := a.helpHeight(contentWidth)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

computeLayout now returns only contentWidth/contentHeight, and renderBody no longer renders a sessions pane. However, sessions focus and handlers still exist in update/key handling. This leaves a hidden Sessions focus state with no visible UI, so users can cycle into an invisible panel and lose direct session browsing/opening from the main screen. Please either keep a visible sessions surface or remove/guard sessions-panel focus/actions consistently.

}

// waterfallMetrics 统一计算瀑布区各组件高度,确保渲染、布局与命中区域使用同一组尺寸。
func (a App) waterfallMetrics(width int, height int) (int, int, int, int) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

waterfallMetrics no longer subtracts prompt height, but renderWaterfall still appends the prompt (and may append Thinking...). Under constrained heights or multi-line input, rendered body height can exceed the allocated contentHeight, causing clipping/overflow. Please include prompt/extra-line height in the same sizing model used for transcript/activity/menu.

tagStyle = a.styles.messageUserTag
bodyStyle = a.styles.messageUserBody
blockAlign = lipgloss.Right
case roleTool:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tool messages are now dropped from transcript rendering (roleTool returns early). This is a user-visible behavior change that removes direct visibility of tool call/results in chat history, which hurts debugging/auditability. If intentional, this should be explicitly documented and covered by tests; otherwise, keep tool messages visible (or provide a dedicated, persistent tool-output view).

@phantom5099 phantom5099 merged commit 8181b5a into 1024XEngineer:main Apr 14, 2026
2 checks passed
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.

2 participants