feat: add Ctrl+Y keyboard shortcut to toggle YOLO mode#1525
Conversation
🦋 Changeset detectedLatest commit: e97c61a 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 |
There was a problem hiding this comment.
💡 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, ''); |
There was a problem hiding this comment.
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 👍 / 👎.
| if (matchesKey(normalized, Key.ctrl('y'))) { | ||
| this.onCtrlY?.(); | ||
| return; |
There was a problem hiding this comment.
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 👍 / 👎.
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
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.