mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 18:03:44 +00:00
feat: use keybindings in all selectors and lists
Update all selector/list components to use EditorKeybindingsManager: - model-selector, session-selector, oauth-selector, user-message-selector - hook-selector, hook-input, hook-editor, tree-selector - select-list, settings-list, cancellable-loader This allows users to configure selectUp, selectDown, selectConfirm, selectCancel actions in keybindings.json
This commit is contained in:
parent
8f2682578b
commit
7574fed2f2
11 changed files with 73 additions and 64 deletions
|
|
@ -2,7 +2,7 @@
|
|||
* Simple text input component for hooks.
|
||||
*/
|
||||
|
||||
import { Container, Input, matchesKey, Spacer, Text } from "@mariozechner/pi-tui";
|
||||
import { Container, getEditorKeybindings, Input, Spacer, Text } from "@mariozechner/pi-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
||||
|
|
@ -46,14 +46,15 @@ export class HookInputComponent extends Container {
|
|||
}
|
||||
|
||||
handleInput(keyData: string): void {
|
||||
const kb = getEditorKeybindings();
|
||||
// Enter
|
||||
if (matchesKey(keyData, "enter") || keyData === "\n") {
|
||||
if (kb.matches(keyData, "selectConfirm") || keyData === "\n") {
|
||||
this.onSubmitCallback(this.input.getValue());
|
||||
return;
|
||||
}
|
||||
|
||||
// Escape or Ctrl+C to cancel
|
||||
if (matchesKey(keyData, "escape") || matchesKey(keyData, "ctrl+c")) {
|
||||
if (kb.matches(keyData, "selectCancel")) {
|
||||
this.onCancelCallback();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue