Skip to content

Commit 004ae6b

Browse files
committed
refactor(tui): drop keymap narration
1 parent d324276 commit 004ae6b

3 files changed

Lines changed: 1 addition & 6 deletions

File tree

‎docs/TUI-keymap-eval.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Decision record for application key bindings on `@opentui/core` 0.6.6. The engin
66

77
**Adopt** `@opentui/keymap` for application commands. Do not move widget-local editing, the scroll lease, or the kill ring into it.
88

9-
`createDefaultOpenTuiKeymap(renderer)` installs the default parser, the event matcher, and the enabled and metadata fields. The shell registers one layer. Each command `run` calls one existing function. There is no parallel key switch. Help lines are the keymap's registered `desc` values plus the widget-default rows.
9+
`keymapFor` builds `new Keymap(guardHost(renderer))`, then registers the default parser, the enabled fields, and the metadata fields. The shell registers one layer. Each command `run` calls one existing function. There is no parallel key switch. Help lines are the keymap's registered `desc` values plus the widget-default rows.
1010

1111
Textarea defaults are not registered again. `renderables/Textarea.d.ts` `TextareaAction` and the shipped `defaultTextareaKeyBindings` already cover cursor motion, word motion, Ctrl+D, Ctrl+K/U/W, and Alt+D. `PROMPT_KEY_BINDINGS` already maps Enter to submit and Ctrl+Enter / Ctrl+J / Shift+Enter to newline. The kill ring only diffs those deletes and yanks.
1212

‎src/tui/keybindings.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* registration (`bindAppHelp`). Widget-default rows are the Textarea chords
44
* `defaultTextareaKeyBindings` / `PROMPT_KEY_BINDINGS` already perform, plus
55
* the kill-ring yank chords the textarea does not implement.
6-
* There is no second copy of the application chord table here.
76
*/
87

98
export interface ShellShortcut {
@@ -80,7 +79,6 @@ let appRows: readonly ShellShortcut[] = [];
8079
let readAppHelp: () => readonly string[] = () =>
8180
appRows.map((row) => `${row.keys} — ${row.description}`);
8281

83-
/** Called when the keymap module loads, and again from the live keymap. */
8482
export function setAppShortcutRows(rows: readonly ShellShortcut[]): void {
8583
appRows = rows;
8684
}
@@ -93,7 +91,6 @@ export function bindAppHelp(read: () => readonly string[]): () => void {
9391
};
9492
}
9593

96-
/** Catalog the live tests drive. Application rows are whatever the keymap registered. */
9794
export function shellShortcuts(): readonly ShellShortcut[] {
9895
return [...appRows, ...WIDGET_DEFAULT_SHORTCUTS];
9996
}

‎src/tui/shell/keymap.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Registers `APP_CHORDS` on `@opentui/keymap`. Lookup belongs to the package.
3-
* There is no second switch from key name to handler.
43
*
54
* The default host keeps its keypress listener until the destroy event, but
65
* `isDestroyed` flips first and leftover stdin then throws inside
@@ -90,7 +89,6 @@ function keymapFor(renderer: CliRenderer): ShellKeymap {
9089
return keymap;
9190
}
9291

93-
/** True while this renderer's keymap is still subscribed to keypress. */
9492
export function shellKeymapListening(renderer: CliRenderer): boolean {
9593
return keymaps.has(renderer) && !detached.has(renderer);
9694
}

0 commit comments

Comments
 (0)