Skip to content

feat(tui): support multiline feedback input - #5042

Merged
7Sageer merged 4 commits into
MoonshotAI:mainfrom
7Sageer:feedback-multiline
Nov 19, 2026
Merged

7Sageer merged 4 commits into
MoonshotAI:mainfrom
7Sageer:feedback-multiline

Conversation

@7Sageer

@7Sageer 7Sageer commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

没有关联 issue。使用 /feedback 的 TUI 用户需要分段写问题、复现和期望,原来的输入框只能编辑一行。这个 PR 让反馈输入变成多行,并用和 settings / permissions 一样的外框把输入区单独框出来。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

核心思路是两层职责分开:弹窗外框用 settings / permissions 的上下主色平线,输入区自己用主色圆角框。不再把多行 Editor 塞进原来那张圆角卡片,也不再套第二层同样的圆角框。Enter 仍提交,Shift-Enter / Ctrl-J 换行。后续附件选择和上传不变。

 FeedbackInputDialog
-  圆角卡片
-    标题 / 说明 / 单行 Input(> 提示)/ 脚注
+  上下主色平线(与 settings / permissions 相同)
+    标题
+    Enter submit · Shift-Enter/Ctrl-J newline · Esc cancel
+    说明
+    圆角输入框(至少三行,左右各收一格,无 >)
+  底线

 后续 feedback 流程:不变
   文本校验 → 附件选择 → 提交

Editor 提交时先清空缓冲区,再调用 onSubmit。弹窗用回调里的完整文本,避免提交空内容。Kitty 键盘协议的释放事件在入口过滤,避免一次按键处理两次。内容超出可视区时,输入框的上下边显示 Editor 自己的滚动提示。

阅读指南

  1. apps/kimi-code/src/tui/components/dialogs/feedback-input-dialog.ts:外框、输入框和提交。
  2. apps/kimi-code/src/tui/commands/prompts.ts:传入弹窗需要的 TUI 上下文。
  3. apps/kimi-code/test/tui/components/dialogs/feedback-input-dialog.test.ts:外框、三行输入框、多行编辑和提交。
  4. changeset 可略读。

Screenshots / Recordings

以下是组件在宽度 60 下的真实渲染。光标落在输入框第一行,零宽的光标标记已略去。改动前是 origin/main 的单行卡片。

改动前 改动后
╭────────────────────────────────────╮
│ │
│ Send feedback to Kimi Code │
│ │
│ Tell us what's working or… │
│ │
│ > │
│ │
│ Enter to submit · Esc to cancel │
│ │
╰────────────────────────────────────╯
────────────────────────────────────────────────────────────
Send feedback to Kimi Code
Enter submit · Shift-Enter/Ctrl-J newline · Esc cancel

Tell us what's working or what's not.
╭────────────────────────────────────────────────────────╮
│ │
│ │
│ │
╰────────────────────────────────────────────────────────╯

────────────────────────────────────────────────────────────

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
/feedback 文本编辑 单行输入,粘贴中的换行被移除 多行输入;Shift-Enter / Ctrl-J 换行,粘贴保留换行 通过 /feedback 提交反馈的 TUI 用户 单行输入仍可直接提交
/feedback 提交 Enter 提交 保持 Enter 提交;长粘贴按完整内容提交 使用单行反馈和键盘提交的 TUI 用户 无需迁移
提交成功文案 Feedback submitted, thank you! Thanks for taking the time to write this. It'll help us make Kimi better 看过旧成功提示的 TUI 用户 无需迁移
弹窗外观 圆角卡片,首行 > 提示,脚注在框底 上下主色平线;说明下是至少三行的圆角输入框,没有 > 习惯旧卡片布局的 TUI 用户 无需迁移
弹窗取消 Esc / Ctrl-C / Ctrl-D 取消 行为不变 使用快捷键取消反馈的 TUI 用户 无需迁移
后续附件选择与反馈上传 文本经过同一附件选择和提交流程 行为不变,文本内容可包含换行 managed Kimi Code 反馈渠道 无需迁移
审批面板中的拒绝理由输入 独立单行输入 行为不变 使用工具审批拒绝/修改理由的 TUI 用户 无需迁移
其他客户端与外部契约 print、desktop、web、VS Code、ACP、SDK 不使用此弹窗 行为不变 非 TUI 用户与外部调用方 无需迁移

受影响模块及覆盖:

  • feedback-input-dialog.ts:覆盖 settings 外框、输入框缩进与三行高度、两行渲染与提交、Shift-Enter、跨行光标编辑、普通及长粘贴、撤销与按词删除、空内容、取消及重复提交。
  • prompts.ts:只传递 TUI 上下文;结果类型和后续流程未改。
  • constant/feedback.ts:成功文案改为感谢用户花时间,并说明这会帮助改进 Kimi。
  • .changeset/feedback-multiline-input.md:minor 发版说明,覆盖多行输入和成功感谢。
验证结果
  • feedback-input-dialog 测试:18 个通过。
  • 改动 TS 文件的 oxlint --type-aware 与提交时的 check-comments:通过。
  • 未实际向反馈服务上传测试文本;服务调用和附件选择逻辑未改。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve). 无关联 issue,需求见上。
  • 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. 此 PR 不包含文档变更。

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 74b1689

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 Minor

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 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T11:32:57.522252Z 74b1689 Manual request
ℹ️ 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.

@7Hanrui

7Hanrui commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@codex review

@pkg-pr-new

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

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

commit: 74b1689

@7Hanrui

7Hanrui commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@codex review

1 similar comment
@7Hanrui

7Hanrui commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2033fa0ead

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

constructor(tui: TUI, onDone: (result: FeedbackInputDialogResult) => void) {
super();
this.onDone = onDone;
this.input = new FeedbackMultilineInput(tui, createEditorTheme(), { paddingX: 2 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve trailing backslashes on Enter

When a feedback message ends in a backslash (for example C:\tmp\), delegating Enter to the stock Editor does not submit it: Editor.handleInput applies its backslash+Enter fallback, deletes that character, and inserts a newline, so a second Enter submits the trimmed message without the backslash. The previous Input submitted this value intact, and the dialog advertises plain Enter as submit, so this silently corrupts a valid feedback value; bypass that fallback for this modal.

Useful? React with 👍 / 👎.

constructor(tui: TUI, onDone: (result: FeedbackInputDialogResult) => void) {
super();
this.onDone = onDone;
this.input = new FeedbackMultilineInput(tui, createEditorTheme(), { paddingX: 2 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor the paste-burst preference in the feedback editor

When disable_paste_burst = true is set, this new Editor is still constructed with only paddingX, so its paste-burst detector stays enabled even though the main editor receives state.appState.disablePasteBurst. On terminals or input methods that trigger the fallback, a rapid run of at least eight characters followed by Enter therefore inserts a newline instead of submitting /feedback, which is exactly the behavior this user preference opts out of; thread the configured value into this editor as well.

Useful? React with 👍 / 👎.

}

override render(width: number): string[] {
const lines = super.render(width).slice(1, -1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain scroll indicators for overflowing feedback

When feedback grows beyond the Editor viewport (for example more than 12 visual lines on a 40-row terminal), Editor.render puts ↑/↓ N more indicators in its first and last rows, but this unconditional slice removes both along with the normal borders. The dialog then shows only the cursor's window with no indication that earlier or later feedback is hidden; strip only the empty borders or preserve the nonempty overflow rows.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58adb07983

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


handleInput(data: string): void {
if (this.done) return;
if (this.done || isKeyRelease(data)) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize Caps-Lock Ctrl-J before dispatch

When the Kitty keyboard protocol is active and Caps Lock is enabled, Ctrl-J can arrive with an uppercase J plus the Ctrl/Caps modifiers; this handler forwards it unchanged, so the base Editor cannot match its lowercase ctrl+j newline binding and the newly advertised shortcut does nothing (Shift-Enter still works). CustomEditor.handleInput already handles this terminal case with normalizeCapsLockedCtrl; apply that normalization before the release/cancel checks and before forwarding the key.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 6637fc5f16

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@7Hanrui

7Hanrui commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 74b1689fdf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@7Sageer
7Sageer merged commit 7e2c565 into MoonshotAI:main Nov 19, 2026
17 checks passed
devin-ai-integration Bot added a commit to 7723qqq/kimi-code that referenced this pull request Nov 24, 2026
…end drift-allow

- bun scripts/upstream-ledger.mjs --refresh: 148 new pending rows covering
  the 2.7.0 tail and upstream/main.
- Mark MoonshotAI#5043/MoonshotAI#5037/MoonshotAI#5049 ported (26f22db, 0d20273, d61aacc) and
  MoonshotAI#5042 equivalent (multiline feedback editor already shipped, localized).
- Refresh MoonshotAI#4820 evidence: the machine-architecture blocker retired with the
  2.7.0 merge.
- drift-allow: add the missing translated/renamed upstream files (media.ts,
  node-local hostServices/rgLocator/runRg, executor validate.ts, remaining
  vitest configs) so upstream-drift stops flagging deliberate removals.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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