Skip to content

fix(tui): truncate question tab headers to terminal width - #279

Merged
LeXwDeX merged 6 commits into
devfrom
fix/question-tab-truncate
Aug 15, 2026
Merged

fix(tui): truncate question tab headers to terminal width#279
LeXwDeX merged 6 commits into
devfrom
fix/question-tab-truncate

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Problem

QA (question tool) 选择界面的 TAB 头部直接渲染 {q.header},无宽度限制。schema 中 header 的 "max 30 chars" 仅为描述性提示不强制,当模型传入长中文 header 时(如 session 产品设计完善:下一步选择流程),每个 tab 按内容自适应撑开成"长条",多个长 tab 超出终端宽后折行,无法保持紧凑 TAB 页布局。

Fix

packages/tui/src/routes/session/question.tsx

  • 新增 truncateWidth():基于 Bun.stringWidth 的显示宽度感知截断(CJK/emoji 安全)
  • 新增 headerBudget memo:按终端宽度与 tab 数分配每个 tab 的显示列预算,clamp 到 [6, 24]
  • TAB 头部渲染改为 truncateWidth(q.header, headerBudget())

Verification

  • bun typecheck (packages/tui) 通过
  • bun test test/index.test.tsx test/keymap.test.tsx 4/4 通过
  • Bun 实测截断:长中文 header 截到预算宽度内(含 …),短 header 原样返回

fix(tool): require plain-object parameter roots per OpenAI tools contract
release: msgid wrap fix, workflow draft action, DAG execution-location ownership
release: session-following location stamps, adoption fencing, app id alignment
release: current-revision DAG view + node-output file refs
release: README rework — graph guide, features, usage
@LeXwDeX
LeXwDeX merged commit 12eeae3 into dev Aug 15, 2026
5 checks passed
@LeXwDeX
LeXwDeX deleted the fix/question-tab-truncate branch August 15, 2026 14:22
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