Skip to content

fix(tui): keep wrapped Grep and Glob glance lines indented - #4617

Merged
Grapedge merged 1 commit into
mainfrom
fix-search-glance-indent
Nov 4, 2026
Merged

Grapedge merged 1 commit into
mainfrom
fix-search-glance-indent

Conversation

@Grapedge

@Grapedge Grapedge commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Requirement or Bug

展开一张 Grep 或 Glob 结果卡片时,第一行是命中文件的样例列表。列表长到需要折行时,第二行起从第 0 列开始,丢了两格缩进,和第一行对不齐。这个 PR 让折出来的每一行都保持缩进。

Bug Reproduction Steps

  1. 让模型运行一次命中多个文件、文件名较长的 Grep 或 Glob。
  2. 点开这张卡片,或者按 ctrl+o 展开。
  3. 把终端调窄,直到样例列表折行。续行从第 0 列开始。

Root Cause

展开时的样例行把两格缩进写进了文字本身(' ' + 样例),而 Text 的 padding 是 0。折行时只有第一行带着这两个空格。这是根本修复:缩进改用 Text 的 padding,折出来的每一行都由组件补上缩进。

Code Changes

tool-renderers/summary.ts 只改了一处:展开时的样例行从「文字里带两个空格、padding 0」改成「文字不带空格、padding 2」。收起时的样例行走另一条路径,不受影响。

Screenshots / Recordings

宽度 36 列时展开一张 Grep 卡片,注意第二、三行的起点。两段都是真实渲染,改动前那段用的是 main 上同一行代码。

改动前 改动后
  src/components/alpha.ts,
src/components/beta.ts,
src/components/gamma.ts, +1 more
  src/components/alpha.ts,
src/components/beta.ts,
src/components/gamma.ts, +1 more

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
展开的 Grep/Glob 卡片,样例列表折行时的续行 从第 0 列开始 和第一行一样缩进两格 无 不需要

受影响的只有 TUI 里展开的 Grep 和 Glob 结果卡片,regular 和 fullscreen 模式都一样。registry.test.ts 新增一条测试,在窄宽度下检查每一行都以两格缩进开头。这条测试在修复前失败,修复后通过。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 15:38
@changeset-bot

changeset-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7a3890

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T04:31:21.903809Z a7a3890 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@a7a3890
npx https://pkg.pr.new/@moonshot-ai/kimi-code@a7a3890

commit: a7a3890

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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

@Grapedge
Grapedge added this pull request to stack #4619 November 2, 2026 15:52
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.
@Grapedge
Grapedge force-pushed the fix-search-glance-indent branch from 0fb8d5e to a7a3890 Compare November 4, 2026 04:29
@Grapedge
Grapedge merged commit 6974ac8 into main Nov 4, 2026
16 checks passed
@Grapedge
Grapedge deleted the fix-search-glance-indent branch November 4, 2026 06:03
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
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.
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.

3 participants