Repository navigation
fix(tui): keep wrapped Grep and Glob glance lines indented - #4617
Conversation
🦋 Changeset detectedLatest commit: a7a3890 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues blocking approval of the Grep and Glob wrapped-result indentation fix.
No open issues 🎉
What changed in this PR
此 PR 修复 TUI 中展开的 Grep 和 Glob 结果卡片在文件列表折行后丢失缩进的问题,收起状态的渲染路径保持不变。
Changes:
- 将文本内的前导空格改为
Text组件的 padding,使折行后的每行保持两格缩进。 - 新增窄宽度下的 Grep 回归测试,检查所有渲染行的缩进。
- 添加 CLI patch changeset,记录此次显示修复。
| File | Description |
|---|---|
apps/kimi-code/test/tui/components/messages/tool-renderers/registry.test.ts |
增加展开的 Grep 文件列表折行缩进测试。 |
apps/kimi-code/src/tui/components/messages/tool-renderers/summary.ts |
使用组件 padding 保持展开列表的逐行缩进。 |
.changeset/search-glance-wrap-indent.md |
记录 Grep 和 Glob 结果列表的缩进修复。 |
Review effort: Balanced
The expanded glance put its two-space indent inside the text, so a file list that wrapped started its continuation lines at column 0. Use the Text padding instead so every wrapped line keeps the indent.
0fb8d5e to
a7a3890
Compare
Port of upstream MoonshotAI/kimi-code 6974ac8 (MoonshotAI#4617). The expanded glance prefixed two spaces inside the styled string, so a wrapped line restarted at column 0 and the file list lost its alignment. The indent now rides on the Text offset, which survives wrapping. The new case renders at width 24 and requires every line to start with two spaces; it fails with the prefix-in-string form. Also settle MoonshotAI#4346: the compacting activity mode and its pane-hidden progress case are already in the tree. Ledger: closed 32 -> 34, remaining 65.
Requirement or Bug
展开一张 Grep 或 Glob 结果卡片时,第一行是命中文件的样例列表。列表长到需要折行时,第二行起从第 0 列开始,丢了两格缩进,和第一行对不齐。这个 PR 让折出来的每一行都保持缩进。
Bug Reproduction Steps
Root Cause
展开时的样例行把两格缩进写进了文字本身(
' ' + 样例),而Text的 padding 是 0。折行时只有第一行带着这两个空格。这是根本修复:缩进改用Text的 padding,折出来的每一行都由组件补上缩进。Code Changes
tool-renderers/summary.ts只改了一处:展开时的样例行从「文字里带两个空格、padding 0」改成「文字不带空格、padding 2」。收起时的样例行走另一条路径,不受影响。Screenshots / Recordings
宽度 36 列时展开一张 Grep 卡片,注意第二、三行的起点。两段都是真实渲染,改动前那段用的是 main 上同一行代码。
Behavior Changes and Affected Users
受影响的只有 TUI 里展开的 Grep 和 Glob 结果卡片,regular 和 fullscreen 模式都一样。
registry.test.ts新增一条测试,在窄宽度下检查每一行都以两格缩进开头。这条测试在修复前失败,修复后通过。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.