Make temporary model selector keybinding configurable (#539)
Fixes #533
This commit is contained in:
@@ -11,6 +11,7 @@ type ConfigurableEditorAction = Extract<
|
||||
| "app.model.cycleForward"
|
||||
| "app.model.cycleBackward"
|
||||
| "app.model.select"
|
||||
| "app.model.selectTemporary"
|
||||
| "app.tools.expand"
|
||||
| "app.thinking.toggle"
|
||||
| "app.editor.external"
|
||||
@@ -29,6 +30,7 @@ const DEFAULT_ACTION_KEYS: Record<ConfigurableEditorAction, KeyId[]> = {
|
||||
"app.model.cycleForward": ["ctrl+p"],
|
||||
"app.model.cycleBackward": ["shift+ctrl+p"],
|
||||
"app.model.select": ["ctrl+l"],
|
||||
"app.model.selectTemporary": ["alt+p"],
|
||||
"app.tools.expand": ["ctrl+o"],
|
||||
"app.thinking.toggle": ["ctrl+t"],
|
||||
"app.editor.external": ["ctrl+g"],
|
||||
@@ -56,7 +58,7 @@ export class CustomEditor extends Editor {
|
||||
onHistorySearch?: () => void;
|
||||
onSuspend?: () => void;
|
||||
onShowHotkeys?: () => void;
|
||||
onQuickSelectModel?: () => void;
|
||||
onSelectModelTemporary?: () => void;
|
||||
/** Called when the configured copy-prompt shortcut is pressed. */
|
||||
onCopyPrompt?: () => void;
|
||||
/** Called when the configured image-paste shortcut is pressed. */
|
||||
@@ -126,9 +128,9 @@ export class CustomEditor extends Editor {
|
||||
return;
|
||||
}
|
||||
|
||||
// Intercept Alt+P for quick model switching
|
||||
if (matchesKey(data, "alt+p") && this.onQuickSelectModel) {
|
||||
this.onQuickSelectModel();
|
||||
// Intercept configured temporary model selector shortcut
|
||||
if (this.#matchesAction(data, "app.model.selectTemporary") && this.onSelectModelTemporary) {
|
||||
this.onSelectModelTemporary();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user