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:
Helmut Januschka
2026-01-03 08:23:56 +01:00
parent 8f2682578b
commit 7574fed2f2
11 changed files with 73 additions and 64 deletions
@@ -7,7 +7,7 @@ import { spawnSync } from "node:child_process";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import { Container, Editor, matchesKey, Spacer, Text, type TUI } from "@mariozechner/pi-tui";
import { Container, Editor, getEditorKeybindings, matchesKey, Spacer, Text, type TUI } from "@mariozechner/pi-tui";
import { getEditorTheme, theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
@@ -67,13 +67,14 @@ export class HookEditorComponent extends Container {
return;
}
const kb = getEditorKeybindings();
// Escape or Ctrl+C to cancel
if (matchesKey(keyData, "escape") || matchesKey(keyData, "ctrl+c")) {
if (kb.matches(keyData, "selectCancel")) {
this.onCancelCallback();
return;
}
// Ctrl+G for external editor
// Ctrl+G for external editor (keep matchesKey for this app-specific action)
if (matchesKey(keyData, "ctrl+g")) {
this.openExternalEditor();
return;