TUItui/input-and-keys
Input, Keys, and Autocomplete
Key Parsing
File: indusagi/src/tui/keys.ts
Key types and helpers:
KeyIdis a type-safe union of key identifiers.Keyis a helper for building key identifiers.parseKey(data)returns the key identifier for raw input.matchesKey(data, keyId)checks if input matches a key identifier.isKeyRepeatandisKeyReleasehandle Kitty keyboard protocol events.
Kitty CSI-u sequences are supported for printable keys. Shift and base layout handling is implemented in the editor to preserve correct characters.
Keybindings
File: indusagi/src/tui/keybindings.ts
EditorActionenumerates editor actions.EditorKeybindingsManagermaps actions to keys and exposesmatches.DEFAULT_EDITOR_KEYBINDINGSis the default mapping.getEditorKeybindingsreturns the global manager.
Input Buffering
File: indusagi/src/tui/stdin-buffer.ts
StdinBuffersplits raw stdin into complete escape sequences.- Supports CSI, OSC, DCS, and APC sequences.
- Emits
dataevents for key sequences andpasteevents for bracketed paste.
Autocomplete
File: indusagi/src/tui/autocomplete.ts
AutocompleteProviderdefinesgetSuggestionsandapplyCompletion.CombinedAutocompleteProvidersupports slash commands and file paths.- Fuzzy file search uses
@prefixsyntax. - File completion can use the external
fdbinary if present.
Fuzzy Matching
File: indusagi/src/tui/fuzzy.ts
fuzzyMatch(query, text)returns a score.fuzzyFilter(items, query, getText)filters and sorts by score.
