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.
This commit is contained in:
can1357
2026-05-31 06:23:27 +02:00
parent 346ae48b0c
commit dcf482c4c4
6 changed files with 11 additions and 10 deletions
+1
View File
@@ -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`
@@ -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)) {
@@ -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"),
@@ -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();
@@ -17,7 +17,6 @@ type FakeEditor = {
onSelectModelTemporary?: () => void;
onSelectModel?: () => void;
onHistorySearch?: () => void;
onShowHotkeys?: () => void;
onPasteImage?: () => void;
onCopyPrompt?: () => void;
onExpandTools?: () => void;
@@ -14,7 +14,6 @@ type FakeEditor = {
onSelectModelTemporary?: () => void;
onSelectModel?: () => void;
onHistorySearch?: () => void;
onShowHotkeys?: () => void;
onPasteImage?: () => Promise<boolean>;
onCopyPrompt?: () => void;
onExpandTools?: () => void;