Skip to content

feat: add Ctrl+Y keyboard shortcut to toggle YOLO mode#1525

Open
yuanyuan06 wants to merge 1 commit into
MoonshotAI:mainfrom
yuanyuan06:feat/ctrl-y-yolo-toggle
Open

feat: add Ctrl+Y keyboard shortcut to toggle YOLO mode#1525
yuanyuan06 wants to merge 1 commit into
MoonshotAI:mainfrom
yuanyuan06:feat/ctrl-y-yolo-toggle

Conversation

@yuanyuan06

Copy link
Copy Markdown

Related Issue

Resolve #(issue_number)

Problem

YOLO 模式只能通过 /yolo 斜杠命令切换,缺少键盘快捷键,影响快速操作体验

What changed

新增 ctrl+y 全局快捷键,按 ctrl+y 可即时切换 YOLO 模式的开关。遵循现有快捷键模式(ctrl+s、ctrl+b、ctrl+o 等),在 CustomEditor 中注册 onCtrlY 回调,EditorKeyboardController 中绑定 telemetry + 委托给 /yolo 切换逻辑

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e97c61a

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 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: e97c61a066

ℹ️ 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".

}

handleYoloToggle(): void {
void slashCommands.handleYoloCommand(this, '');

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 Don't bypass /yolo error handling

When session.setPermission(...) rejects (for example after the server/RPC connection drops), the typed /yolo path reports the failure because built-in slash commands are wrapped in executeSlashCommand's try/catch, but this shortcut calls the async handler with void and no catch. That leaves the rejection unhandled (potentially terminating the TUI under Node's unhandled-rejection behavior) and the user gets no error; attach a catch/showError or route through the same dispatch path.

Useful? React with 👍 / 👎.

Comment on lines +445 to +447
if (matchesKey(normalized, Key.ctrl('y'))) {
this.onCtrlY?.();
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 Avoid stealing the editor yank binding

When a user is editing a prompt after killing text with Ctrl-K/Ctrl-U/Ctrl-W, pi-tui's editor expects Ctrl-Y to yank the kill ring (packages/pi-tui/src/keybindings.ts:115). This early return runs before super.handleInput, so the yank handler is never reached and Ctrl-Y toggles YOLO instead, leaving killed text unrecoverable from the keyboard; choose a non-editor binding or add context/fallthrough so prompt editing still works.

Useful? React with 👍 / 👎.

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