mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08: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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user