From dcf482c4c458e325e5482b607441ebd1eca5b9d9 Mon Sep 17 00:00:00 2001 From: can1357 Date: Sun, 31 May 2026 06:23:27 +0200 Subject: [PATCH] fix(editor): removed `?` shortcut that opened hotkeys when input was empty - Dropped `onShowHotkeys` callback and its binding from `CustomEditor` and `InputController`. - `?` now inserts a literal question mark regardless of editor state; use `/hotkeys` explicitly. - Added regression test confirming `?` is treated as plain input when the editor is empty. --- packages/coding-agent/CHANGELOG.md | 1 + .../coding-agent/src/modes/components/custom-editor.ts | 7 ------- .../src/modes/controllers/input-controller.ts | 1 - .../test/custom-editor-keybindings.test.ts | 10 ++++++++++ .../coding-agent/test/input-controller-escape.test.ts | 1 - .../test/input-controller-keybindings.test.ts | 1 - 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 19ca95587..14daf601f 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -10,6 +10,7 @@ ### Changed - Changed Shift+Ctrl+P to cycle role models backward instead of cycling forward without persisting. +- Changed empty prompt input so `?` inserts a literal question mark instead of opening `/hotkeys`; use `/hotkeys` explicitly for the shortcut reference. - Changed `search` output to preserve full virtual and internal URL paths in grouped results and `details.files` instead of collapsing them to file basenames - Changed `/omfg` to run up to three generation attempts with validation feedback and only prompt saving when no draft matches assistant history - Changed `/omfg` to show a live draft panel with generation/validation/saving status and allow canceling an active rule request with `Esc` diff --git a/packages/coding-agent/src/modes/components/custom-editor.ts b/packages/coding-agent/src/modes/components/custom-editor.ts index dd2652548..8b7c2bfab 100644 --- a/packages/coding-agent/src/modes/components/custom-editor.ts +++ b/packages/coding-agent/src/modes/components/custom-editor.ts @@ -61,7 +61,6 @@ export class CustomEditor extends Editor { onExternalEditor?: () => void; onHistorySearch?: () => void; onSuspend?: () => void; - onShowHotkeys?: () => void; onSelectModelTemporary?: () => void; /** Called when the configured copy-prompt shortcut is pressed. */ onCopyPrompt?: () => void; @@ -221,12 +220,6 @@ export class CustomEditor extends Editor { return; } - // Intercept ? when editor is empty to show hotkeys - if (data === "?" && this.getText().length === 0 && this.onShowHotkeys) { - this.onShowHotkeys(); - return; - } - // Check custom key handlers (extensions) for (const [keyId, handler] of this.#customKeyHandlers) { if (matchesKey(data, keyId)) { diff --git a/packages/coding-agent/src/modes/controllers/input-controller.ts b/packages/coding-agent/src/modes/controllers/input-controller.ts index 10bad4c5f..eed791c19 100644 --- a/packages/coding-agent/src/modes/controllers/input-controller.ts +++ b/packages/coding-agent/src/modes/controllers/input-controller.ts @@ -183,7 +183,6 @@ export class InputController { this.ctx.editor.onToggleThinking = () => this.ctx.toggleThinkingBlockVisibility(); this.ctx.editor.setActionKeys("app.editor.external", this.ctx.keybindings.getKeys("app.editor.external")); this.ctx.editor.onExternalEditor = () => void this.openExternalEditor(); - this.ctx.editor.onShowHotkeys = () => this.ctx.handleHotkeysCommand(); this.ctx.editor.setActionKeys( "app.clipboard.pasteImage", this.ctx.keybindings.getKeys("app.clipboard.pasteImage"), diff --git a/packages/coding-agent/test/custom-editor-keybindings.test.ts b/packages/coding-agent/test/custom-editor-keybindings.test.ts index 44c7aef46..23a246c2e 100644 --- a/packages/coding-agent/test/custom-editor-keybindings.test.ts +++ b/packages/coding-agent/test/custom-editor-keybindings.test.ts @@ -10,6 +10,16 @@ function createEditor() { return new CustomEditor(defaultEditorTheme); } +describe("CustomEditor literal question mark input", () => { + it("does not reserve ? as a hotkeys shortcut when the editor is empty", () => { + const editor = createEditor(); + + editor.handleInput("?"); + + expect(editor.getText()).toBe("?"); + }); +}); + describe("CustomEditor temporary model selector keybinding", () => { it("triggers the temporary selector from a remapped action key instead of Alt+P", () => { const editor = createEditor(); diff --git a/packages/coding-agent/test/input-controller-escape.test.ts b/packages/coding-agent/test/input-controller-escape.test.ts index 407a83341..5d2bd5dff 100644 --- a/packages/coding-agent/test/input-controller-escape.test.ts +++ b/packages/coding-agent/test/input-controller-escape.test.ts @@ -17,7 +17,6 @@ type FakeEditor = { onSelectModelTemporary?: () => void; onSelectModel?: () => void; onHistorySearch?: () => void; - onShowHotkeys?: () => void; onPasteImage?: () => void; onCopyPrompt?: () => void; onExpandTools?: () => void; diff --git a/packages/coding-agent/test/input-controller-keybindings.test.ts b/packages/coding-agent/test/input-controller-keybindings.test.ts index ac09ac074..1700b7ab5 100644 --- a/packages/coding-agent/test/input-controller-keybindings.test.ts +++ b/packages/coding-agent/test/input-controller-keybindings.test.ts @@ -14,7 +14,6 @@ type FakeEditor = { onSelectModelTemporary?: () => void; onSelectModel?: () => void; onHistorySearch?: () => void; - onShowHotkeys?: () => void; onPasteImage?: () => Promise; onCopyPrompt?: () => void; onExpandTools?: () => void;