Skip to content

fix(tui): 调整界面大小,增加面板搜索,对齐输入格式,调整md渲染#449

Merged
phantom5099 merged 1 commit into1024XEngineer:mainfrom
creatang:codex/tui-scrollbar-thumb-only
Apr 26, 2026
Merged

fix(tui): 调整界面大小,增加面板搜索,对齐输入格式,调整md渲染#449
phantom5099 merged 1 commit into1024XEngineer:mainfrom
creatang:codex/tui-scrollbar-thumb-only

Conversation

@creatang
Copy link
Copy Markdown
Collaborator

变更概述

本次改动聚焦 TUI 体验一致性与可用性优化,主要包含四个方向:

  • 调整界面尺寸与窗口适配阈值
  • 增加各类面板搜索能力并统一为模糊匹配
  • 统一输入与消息渲染格式,修复对齐/缩进不一致
  • 调整 Markdown 渲染,去除异常高亮背景并保留可读性

主要改动

1) 界面大小与窗口适配

  • 启动/主界面最小窗口要求统一回 60x30
  • 小窗口提示文案与实际阈值保持一致
  • 同步更新相关测试断言,避免 CI 因尺寸提示不一致失败

2) 面板搜索能力增强

  • /provider/model/session/help picker 统一启用搜索框
  • 打开 picker 时默认进入可过滤状态,支持直接输入搜索
  • 修复 /model 在异步刷新后搜索状态丢失的问题
  • 修复“输入后不即时过滤”和“过滤时上下键无法移动”问题
  • 统一搜索体验为模糊匹配(fuzzy),包括:
    • picker 搜索
    • slash 命令建议
    • 文件建议列表

3) 输入/消息格式对齐

  • 统一用户与 AI 消息的渲染路径,修复缩进和对齐不一致
  • 调整部分列表/面板渲染细节,提升不同终端下显示一致性

4) Markdown 渲染优化

  • 去除非代码内容中的彩色背景高亮块,避免异常橙色/色块渲染
  • 保留代码块灰底等中性背景,保证可读性
  • 清理 token 级别不必要背景色,降低主题差异带来的视觉噪音

命令行为变更

  • 移除 /status 命令及其帮助入口
  • 同步更新相关测试和文档(README、quick-start)

测试与验证

已完成并通过:

  • go test ./internal/tui/core/app -count=1
  • go test ./internal/tui/core/commands -count=1
  • go test ./internal/tui/services -count=1
  • go test ./internal/tui/... -count=1

影响范围

  • internal/tui/core/app/*
  • internal/tui/core/commands/*
  • internal/tui/services/*
  • internal/tui/infra/markdown_renderer*
  • README.md
  • www/guide/quick-start.md

风险与兼容性说明

  • 搜索结果排序可能因 fuzzy 打分与此前前缀/包含策略不同而变化(属预期优化)
  • /status 被移除后,依赖该命令的使用习惯需切换到现有状态展示路径(header/picker/activity)

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

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

整体改动方向清晰,测试覆盖也比较完整;但当前 diff 里有两处值得尽快修正的问题:一处会影响 /help 中命令可执行性,一处会在大工作区下引入输入时延。

{Usage: slashUsageClear, Description: "Clear the current draft transcript"},
{Usage: slashUsageCompact, Description: "Compact the current session context"},
{Usage: slashUsageStatus, Description: "Show current session and agent status"},
{Usage: slashUsageWorkdir, Description: "Show or set current session workspace root (/cwd [path])"},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] 这里把 /cwd 作为可运行命令展示在 /help 列表中,但当前执行路径里它不会被 runSlashCommandSelection 直接处理,最终会落到 executeLocalCommandunknown command。本 PR 的测试也在显式断言这个错误行为(update_test.go 2095+)。这会让用户在 help picker 里按 Enter 执行 /cwd 时直接失败,和“帮助即可执行”的交互语义不一致。建议要么在选择执行路径里补上 /cwd 处理,要么把 help picker 中带参数/非可直接执行项改成仅展示不执行。

return out
}

targets := make([]string, 0, len(candidates))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] 这里每次输入变化都会为全部候选文件重新构造一份 lowercase targets,再做一次全量 fuzzy.Find。在 maxWorkspaceFiles=4000 且按键实时建议的路径上,这会带来持续的 O(n) 分配与匹配开销。建议在刷新文件候选时预计算并缓存归一化文本(或复用可变缓冲),避免每个 key stroke 都重复构造 targets

@creatang
Copy link
Copy Markdown
Collaborator Author

113b69f79e379117b9d20b7dbae11fa8

还有个鼠标拖拽后渲染偏移

@fennoai fennoai Bot mentioned this pull request Apr 24, 2026
@phantom5099 phantom5099 merged commit d598a0b into 1024XEngineer:main Apr 26, 2026
2 of 3 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