@linxiraos/pi-tui 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/THIRD-PARTY-NOTICES.txt +22909 -0
- package/dist/types/autocomplete.d.ts +127 -0
- package/dist/types/bracketed-paste.d.ts +51 -0
- package/dist/types/components/box.d.ts +31 -0
- package/dist/types/components/cancellable-loader.d.ts +21 -0
- package/dist/types/components/composer/borderless.d.ts +8 -0
- package/dist/types/components/composer/box.d.ts +2 -0
- package/dist/types/components/composer/claude.d.ts +8 -0
- package/dist/types/components/composer/field.d.ts +3 -0
- package/dist/types/components/composer/index.d.ts +9 -0
- package/dist/types/components/composer/pi.d.ts +2 -0
- package/dist/types/components/composer/rail.d.ts +3 -0
- package/dist/types/components/composer/registry.d.ts +12 -0
- package/dist/types/components/composer/rule.d.ts +7 -0
- package/dist/types/components/composer/types.d.ts +90 -0
- package/dist/types/components/editor.d.ts +213 -0
- package/dist/types/components/image.d.ts +162 -0
- package/dist/types/components/input.d.ts +25 -0
- package/dist/types/components/loader.d.ts +25 -0
- package/dist/types/components/markdown.d.ts +86 -0
- package/dist/types/components/scroll-view.d.ts +62 -0
- package/dist/types/components/select-list.d.ts +78 -0
- package/dist/types/components/settings-list.d.ts +129 -0
- package/dist/types/components/spacer.d.ts +11 -0
- package/dist/types/components/tab-bar.d.ts +89 -0
- package/dist/types/components/text.d.ts +27 -0
- package/dist/types/components/truncated-text.d.ts +10 -0
- package/dist/types/deccara.d.ts +49 -0
- package/dist/types/desktop-notify.d.ts +52 -0
- package/dist/types/editor-component.d.ts +38 -0
- package/dist/types/fuzzy.d.ts +48 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/keybindings.d.ts +202 -0
- package/dist/types/keys.d.ts +210 -0
- package/dist/types/kill-ring.d.ts +20 -0
- package/dist/types/kitty-graphics.d.ts +76 -0
- package/dist/types/latex-block.d.ts +8 -0
- package/dist/types/latex-to-unicode.d.ts +50 -0
- package/dist/types/loop-watchdog.d.ts +49 -0
- package/dist/types/mouse.d.ts +67 -0
- package/dist/types/stdin-buffer.d.ts +60 -0
- package/dist/types/symbols.d.ts +25 -0
- package/dist/types/terminal-capabilities.d.ts +338 -0
- package/dist/types/terminal.d.ts +215 -0
- package/dist/types/tmux.d.ts +6 -0
- package/dist/types/ttyid.d.ts +9 -0
- package/dist/types/tui.d.ts +332 -0
- package/dist/types/utils.d.ts +112 -0
- package/package.json +71 -68
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Component } from "../tui.js";
|
|
2
|
+
/**
|
|
3
|
+
* Text component - displays multi-line text with word wrapping.
|
|
4
|
+
*
|
|
5
|
+
* Foreground colors may be supplied lazily via {@link setStyleFn} instead of
|
|
6
|
+
* baked into `text`: the styler runs at render time, so a caller that
|
|
7
|
+
* invalidates the component on a theme change (see the coding-agent's
|
|
8
|
+
* `onThemeChange` handler) re-resolves the color against the now-active theme
|
|
9
|
+
* rather than replaying the palette active when the component was constructed.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Text implements Component {
|
|
12
|
+
#private;
|
|
13
|
+
setIgnoreTight(ignore: boolean): this;
|
|
14
|
+
constructor(text?: string, paddingX?: number, paddingY?: number, customBgFn?: (text: string) => string);
|
|
15
|
+
getText(): string;
|
|
16
|
+
setText(text: string): boolean;
|
|
17
|
+
setCustomBgFn(customBgFn?: (text: string) => string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Supply a foreground styler applied to the text at render time (e.g. a
|
|
20
|
+
* theme color resolver). Unlike baking the color into `text`, the styler
|
|
21
|
+
* re-runs on every render, so invalidating the component after a theme
|
|
22
|
+
* change re-resolves the color against the active theme.
|
|
23
|
+
*/
|
|
24
|
+
setStyleFn(styleFn?: (text: string) => string): this;
|
|
25
|
+
invalidate(): void;
|
|
26
|
+
render(width: number): readonly string[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from "../tui.js";
|
|
2
|
+
/**
|
|
3
|
+
* Text component that truncates to fit viewport width
|
|
4
|
+
*/
|
|
5
|
+
export declare class TruncatedText implements Component {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(text: string, paddingX?: number, paddingY?: number);
|
|
8
|
+
invalidate(): void;
|
|
9
|
+
render(width: number): readonly string[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** DECSACE — select the rectangle change extent so DECCARA fills a rectangle. */
|
|
2
|
+
export declare const DECSACE_RECT = "\u001B[2*x";
|
|
3
|
+
/** DECSACE — restore the default (stream) change extent. */
|
|
4
|
+
export declare const DECSACE_DEFAULT = "\u001B[*x";
|
|
5
|
+
/**
|
|
6
|
+
* Encode a single DECCARA rectangle. `top`/`bottom` are 1-based inclusive screen
|
|
7
|
+
* rows, `left`/`right` 1-based inclusive columns, `sgr` the raw SGR parameter
|
|
8
|
+
* list to apply (e.g. `48;2;10;20;30`, `48;5;4`, `41`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function encodeDeccara(top: number, left: number, bottom: number, right: number, sgr: string): string;
|
|
11
|
+
/** Where to cut a fillable line and the background to paint over the remainder. */
|
|
12
|
+
export interface BgFillAnalysis {
|
|
13
|
+
/** Byte index where droppable trailing background padding begins (0 = whole line). */
|
|
14
|
+
cut: number;
|
|
15
|
+
/** 0-based column where the trailing padding begins (DECCARA left = leftCol + 1). */
|
|
16
|
+
leftCol: number;
|
|
17
|
+
/** SGR parameter list of the background covering the trailing region. */
|
|
18
|
+
bg: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Decide whether `line` (a final, width-fit, reset-terminated ANSI string) is a
|
|
22
|
+
* full-width background fill whose trailing padding can be replaced by a DECCARA
|
|
23
|
+
* rectangle. Returns `null` unless it can *prove* the dropped bytes are literal
|
|
24
|
+
* trailing spaces under a single, constant, non-default background span (or the
|
|
25
|
+
* entire row is background-styled spaces).
|
|
26
|
+
*
|
|
27
|
+
* Conservative by construction: any OSC sequence (hyperlinks/images), any
|
|
28
|
+
* non-SGR CSI, a partial row, an inconsistent or default trailing background, or
|
|
29
|
+
* a malformed escape all yield `null` so the caller keeps the exact original.
|
|
30
|
+
*/
|
|
31
|
+
export declare function analyzeBgFillLine(line: string, width: number): BgFillAnalysis | null;
|
|
32
|
+
/** Per-frame plan: the (possibly shortened) row strings and the DECCARA batch. */
|
|
33
|
+
export interface DeccaraPlan {
|
|
34
|
+
/** Row strings to write, parallel to the input. Optimized rows are shortened. */
|
|
35
|
+
texts: string[];
|
|
36
|
+
/** DECSACE-wrapped rectangle batch to emit after the rows, or `""` if none. */
|
|
37
|
+
sequence: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Plan DECCARA rectangles for a contiguous block of visible rows.
|
|
41
|
+
*
|
|
42
|
+
* `lines[k]` is the final ANSI string for screen row `firstScreenRow + k`
|
|
43
|
+
* (0-based). For each fillable row the trailing background padding is removed
|
|
44
|
+
* (the row's cells are cleared/erased by the caller, then repainted by the
|
|
45
|
+
* rectangle), and vertically adjacent rows with an identical left/right/bg span
|
|
46
|
+
* coalesce into one rectangle. Rectangles are emitted only when they save more
|
|
47
|
+
* bytes than they cost, so the result never exceeds the original byte count.
|
|
48
|
+
*/
|
|
49
|
+
export declare function planDeccaraFills(lines: string[], width: number, firstScreenRow?: number): DeccaraPlan;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { TerminalId, TerminalNotification } from "./terminal-capabilities.js";
|
|
2
|
+
/** Resolved notifier binary used to fan a notification out to D-Bus. */
|
|
3
|
+
export type DesktopNotifierKind = "notify-send" | "gdbus";
|
|
4
|
+
export interface DesktopNotifier {
|
|
5
|
+
kind: DesktopNotifierKind;
|
|
6
|
+
path: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Whether the current process can reach a freedesktop notification daemon:
|
|
10
|
+
* Linux platform plus either a session bus address in env or the
|
|
11
|
+
* systemd user-bus socket at `$XDG_RUNTIME_DIR/bus`. Caller is still responsible for
|
|
12
|
+
* resolving a delivery binary via {@link resolveDesktopNotifier}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasLinuxDesktopSession(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv, fileExists?: (path: string) => boolean): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether `sendNotification` should also dispatch a D-Bus toast for this
|
|
17
|
+
* terminal. Returns true only when (1) the chosen `notifyProtocol` is BEL,
|
|
18
|
+
* which cannot carry arbitrary toast text, (2) the host exposes a Linux desktop
|
|
19
|
+
* session, and (3) the user has not opted out via `PI_NO_DESKTOP_NOTIFY=1`.
|
|
20
|
+
* Terminals that genuinely speak OSC 9 / OSC 99 pass
|
|
21
|
+
* `notifyProtocolIsBell=false` and are filtered before the D-Bus fallback can
|
|
22
|
+
* run. Pure helper for tests and the singleton path.
|
|
23
|
+
*/
|
|
24
|
+
export declare function shouldDeliverDesktopNotification(_terminalId: TerminalId, notifyProtocolIsBell: boolean, platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv): boolean;
|
|
25
|
+
/** Reset the cached notifier resolution. Tests only. */
|
|
26
|
+
export declare function resetDesktopNotifierCache(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Locate a libnotify-compatible delivery binary on `PATH`, preferring
|
|
29
|
+
* `notify-send` (one-shot, no marshalling) and falling back to `gdbus call`
|
|
30
|
+
* for hosts where libnotify is not installed but GLib is. Result is cached so
|
|
31
|
+
* repeated notifications do not hit `$which` again.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveDesktopNotifier(): DesktopNotifier | null;
|
|
34
|
+
/**
|
|
35
|
+
* Build the argv that delivers `message` through the resolved notifier. Pure
|
|
36
|
+
* helper so tests assert exact wire shape without spawning a child. Notes:
|
|
37
|
+
* - `notify-send` accepts title + body positionally and a numeric expire
|
|
38
|
+
* timeout (`-t`); urgency is a flag.
|
|
39
|
+
* - `gdbus call ... Notify` takes the freedesktop signature
|
|
40
|
+
* `s u s s s as a{sv} i`: app_name, replaces_id, app_icon, summary, body,
|
|
41
|
+
* actions, hints, expire_timeout. We feed hints with the urgency byte so
|
|
42
|
+
* the daemon classifies the toast identically to `notify-send`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildDesktopNotifyCommand(notifier: DesktopNotifier, message: string | TerminalNotification): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Fire-and-forget D-Bus desktop notification. Resolves a notifier, spawns it
|
|
47
|
+
* with stdio fully detached, and never throws — terminal notifications are
|
|
48
|
+
* best-effort and must not block the renderer or interleave bytes onto
|
|
49
|
+
* stdout. Caller is responsible for the gating check
|
|
50
|
+
* ({@link shouldDeliverDesktopNotification}).
|
|
51
|
+
*/
|
|
52
|
+
export declare function sendDesktopNotification(message: string | TerminalNotification): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AutocompleteProvider } from "./autocomplete.js";
|
|
2
|
+
import type { Component } from "./tui.js";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for custom editor components.
|
|
5
|
+
*
|
|
6
|
+
* This allows extensions to provide their own editor implementation
|
|
7
|
+
* (e.g., vim mode, emacs mode, custom keybindings) while maintaining
|
|
8
|
+
* compatibility with the core application.
|
|
9
|
+
*/
|
|
10
|
+
export interface EditorComponent extends Component {
|
|
11
|
+
/** Get the current text content */
|
|
12
|
+
getText(): string;
|
|
13
|
+
/** Set the text content */
|
|
14
|
+
setText(text: string): void;
|
|
15
|
+
/** Handle raw terminal input (key presses, paste sequences, etc.) */
|
|
16
|
+
handleInput(data: string): void;
|
|
17
|
+
/** Called when user submits (e.g., Enter key) */
|
|
18
|
+
onSubmit?: (text: string) => void;
|
|
19
|
+
/** Programmatically trigger submission (optional, e.g. for voice submit). */
|
|
20
|
+
submit?(): void;
|
|
21
|
+
/** Called when text changes */
|
|
22
|
+
onChange?: (text: string) => void;
|
|
23
|
+
/** Add text to history for up/down navigation */
|
|
24
|
+
addToHistory?(text: string): void;
|
|
25
|
+
/** Insert text at current cursor position */
|
|
26
|
+
insertTextAtCursor?(text: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get text with any markers expanded (e.g., paste markers).
|
|
29
|
+
* Falls back to getText() if not implemented.
|
|
30
|
+
*/
|
|
31
|
+
getExpandedText?(): string;
|
|
32
|
+
/** Set the autocomplete provider */
|
|
33
|
+
setAutocompleteProvider?(provider: AutocompleteProvider): void;
|
|
34
|
+
/** Border color function */
|
|
35
|
+
borderColor?: (str: string) => string;
|
|
36
|
+
/** Set horizontal padding */
|
|
37
|
+
setPaddingX?(padding: number): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fuzzy matching utilities.
|
|
3
|
+
*
|
|
4
|
+
* Matching is deliberately word-local for normal words. This keeps a query like
|
|
5
|
+
* "image provider" from matching a long setting description only because the
|
|
6
|
+
* letters i-m-a-g-e appear somewhere in order across unrelated words.
|
|
7
|
+
*
|
|
8
|
+
* Lower score = better match.
|
|
9
|
+
*/
|
|
10
|
+
export interface FuzzyMatch {
|
|
11
|
+
matches: boolean;
|
|
12
|
+
score: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FuzzyFilterResult<T> {
|
|
15
|
+
item: T;
|
|
16
|
+
score: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function fuzzyMatch(query: string, text: string): FuzzyMatch;
|
|
19
|
+
/**
|
|
20
|
+
* A text prepared once for repeated fuzzy matching.
|
|
21
|
+
*
|
|
22
|
+
* `fuzzyMatch` builds a search index per call; the module cache only admits
|
|
23
|
+
* texts up to {@link MAX_CACHED_TEXT_LEN}, so long corpora (session or
|
|
24
|
+
* transcript search) rebuild the index on every keystroke — the dominant cost
|
|
25
|
+
* when a selector re-filters a stable candidate list as the user types. Build
|
|
26
|
+
* one `FuzzyText` per candidate and call {@link match} per query instead; the
|
|
27
|
+
* index lives exactly as long as the caller's reference.
|
|
28
|
+
*/
|
|
29
|
+
export declare class FuzzyText {
|
|
30
|
+
#private;
|
|
31
|
+
constructor(text: string);
|
|
32
|
+
/** Match `query` (space-separated tokens; all must match) against the prepared text. */
|
|
33
|
+
match(query: string): FuzzyMatch;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Filter and sort items by fuzzy match quality (best matches first).
|
|
37
|
+
* Supports space-separated tokens: all tokens must match.
|
|
38
|
+
*/
|
|
39
|
+
export declare function fuzzyRank<T>(items: T[], query: string, getText: (item: T) => string): FuzzyFilterResult<T>[];
|
|
40
|
+
export declare function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[];
|
|
41
|
+
/**
|
|
42
|
+
* Clear the fuzzy search-index cache. Intended for tests/benchmarks so a fresh
|
|
43
|
+
* cold-start typing session can be measured on demand; not part of the supported
|
|
44
|
+
* TUI API.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export declare function resetFuzzyIndexCache(): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from "./autocomplete.js";
|
|
2
|
+
export * from "./components/box.js";
|
|
3
|
+
export * from "./components/cancellable-loader.js";
|
|
4
|
+
export * from "./components/composer/index.js";
|
|
5
|
+
export * from "./components/editor.js";
|
|
6
|
+
export * from "./components/image.js";
|
|
7
|
+
export * from "./components/input.js";
|
|
8
|
+
export * from "./components/loader.js";
|
|
9
|
+
export * from "./components/markdown.js";
|
|
10
|
+
export * from "./components/scroll-view.js";
|
|
11
|
+
export * from "./components/select-list.js";
|
|
12
|
+
export * from "./components/settings-list.js";
|
|
13
|
+
export * from "./components/spacer.js";
|
|
14
|
+
export * from "./components/tab-bar.js";
|
|
15
|
+
export * from "./components/text.js";
|
|
16
|
+
export * from "./components/truncated-text.js";
|
|
17
|
+
export * from "./deccara.js";
|
|
18
|
+
export * from "./desktop-notify.js";
|
|
19
|
+
export type * from "./editor-component.js";
|
|
20
|
+
export * from "./fuzzy.js";
|
|
21
|
+
export * from "./keybindings.js";
|
|
22
|
+
export * from "./keys.js";
|
|
23
|
+
export * from "./kitty-graphics.js";
|
|
24
|
+
export * from "./latex-block.js";
|
|
25
|
+
export * from "./latex-to-unicode.js";
|
|
26
|
+
export * from "./mouse.js";
|
|
27
|
+
export * from "./stdin-buffer.js";
|
|
28
|
+
export type * from "./symbols.js";
|
|
29
|
+
export * from "./terminal.js";
|
|
30
|
+
export * from "./terminal-capabilities.js";
|
|
31
|
+
export * from "./ttyid.js";
|
|
32
|
+
export * from "./tui.js";
|
|
33
|
+
export * from "./utils.js";
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { type KeyId } from "./keys.js";
|
|
2
|
+
/**
|
|
3
|
+
* Global keybinding registry.
|
|
4
|
+
* Downstream packages can add keybindings via declaration merging.
|
|
5
|
+
*/
|
|
6
|
+
export interface Keybindings {
|
|
7
|
+
"tui.editor.cursorUp": true;
|
|
8
|
+
"tui.editor.cursorDown": true;
|
|
9
|
+
"tui.editor.cursorLeft": true;
|
|
10
|
+
"tui.editor.cursorRight": true;
|
|
11
|
+
"tui.editor.cursorWordLeft": true;
|
|
12
|
+
"tui.editor.cursorWordRight": true;
|
|
13
|
+
"tui.editor.cursorLineStart": true;
|
|
14
|
+
"tui.editor.cursorLineEnd": true;
|
|
15
|
+
"tui.editor.jumpForward": true;
|
|
16
|
+
"tui.editor.jumpBackward": true;
|
|
17
|
+
"tui.editor.pageUp": true;
|
|
18
|
+
"tui.editor.pageDown": true;
|
|
19
|
+
"tui.editor.deleteCharBackward": true;
|
|
20
|
+
"tui.editor.deleteCharForward": true;
|
|
21
|
+
"tui.editor.deleteWordBackward": true;
|
|
22
|
+
"tui.editor.deleteWordForward": true;
|
|
23
|
+
"tui.editor.deleteToLineStart": true;
|
|
24
|
+
"tui.editor.deleteToLineEnd": true;
|
|
25
|
+
"tui.editor.yank": true;
|
|
26
|
+
"tui.editor.yankPop": true;
|
|
27
|
+
"tui.editor.undo": true;
|
|
28
|
+
"tui.editor.spellingSuggestions": true;
|
|
29
|
+
"tui.input.newLine": true;
|
|
30
|
+
"tui.input.submit": true;
|
|
31
|
+
"tui.input.tab": true;
|
|
32
|
+
"tui.input.copy": true;
|
|
33
|
+
"tui.select.up": true;
|
|
34
|
+
"tui.select.down": true;
|
|
35
|
+
"tui.select.pageUp": true;
|
|
36
|
+
"tui.select.pageDown": true;
|
|
37
|
+
"tui.select.confirm": true;
|
|
38
|
+
"tui.select.cancel": true;
|
|
39
|
+
}
|
|
40
|
+
export type Keybinding = keyof Keybindings;
|
|
41
|
+
export type { KeyId };
|
|
42
|
+
export interface KeybindingDefinition {
|
|
43
|
+
defaultKeys: KeyId | KeyId[];
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
export type KeybindingDefinitions = Record<string, KeybindingDefinition>;
|
|
47
|
+
export type KeybindingsConfig = Record<string, KeyId | KeyId[] | undefined>;
|
|
48
|
+
export declare const TUI_KEYBINDINGS: {
|
|
49
|
+
readonly "tui.editor.cursorUp": {
|
|
50
|
+
readonly defaultKeys: "up";
|
|
51
|
+
readonly description: "Move cursor up";
|
|
52
|
+
};
|
|
53
|
+
readonly "tui.editor.cursorDown": {
|
|
54
|
+
readonly defaultKeys: "down";
|
|
55
|
+
readonly description: "Move cursor down";
|
|
56
|
+
};
|
|
57
|
+
readonly "tui.editor.cursorLeft": {
|
|
58
|
+
readonly defaultKeys: ["left", "ctrl+b"];
|
|
59
|
+
readonly description: "Move cursor left";
|
|
60
|
+
};
|
|
61
|
+
readonly "tui.editor.cursorRight": {
|
|
62
|
+
readonly defaultKeys: ["right", "ctrl+f"];
|
|
63
|
+
readonly description: "Move cursor right";
|
|
64
|
+
};
|
|
65
|
+
readonly "tui.editor.cursorWordLeft": {
|
|
66
|
+
readonly defaultKeys: ["alt+left", "ctrl+left", "alt+b"];
|
|
67
|
+
readonly description: "Move cursor word left";
|
|
68
|
+
};
|
|
69
|
+
readonly "tui.editor.cursorWordRight": {
|
|
70
|
+
readonly defaultKeys: ["alt+right", "ctrl+right", "alt+f"];
|
|
71
|
+
readonly description: "Move cursor word right";
|
|
72
|
+
};
|
|
73
|
+
readonly "tui.editor.cursorLineStart": {
|
|
74
|
+
readonly defaultKeys: ["home", "ctrl+a"];
|
|
75
|
+
readonly description: "Move to line start";
|
|
76
|
+
};
|
|
77
|
+
readonly "tui.editor.cursorLineEnd": {
|
|
78
|
+
readonly defaultKeys: ["end", "ctrl+e"];
|
|
79
|
+
readonly description: "Move to line end";
|
|
80
|
+
};
|
|
81
|
+
readonly "tui.editor.jumpForward": {
|
|
82
|
+
readonly defaultKeys: "ctrl+]";
|
|
83
|
+
readonly description: "Jump forward to character";
|
|
84
|
+
};
|
|
85
|
+
readonly "tui.editor.jumpBackward": {
|
|
86
|
+
readonly defaultKeys: "ctrl+alt+]";
|
|
87
|
+
readonly description: "Jump backward to character";
|
|
88
|
+
};
|
|
89
|
+
readonly "tui.editor.pageUp": {
|
|
90
|
+
readonly defaultKeys: "pageUp";
|
|
91
|
+
readonly description: "Page up";
|
|
92
|
+
};
|
|
93
|
+
readonly "tui.editor.pageDown": {
|
|
94
|
+
readonly defaultKeys: "pageDown";
|
|
95
|
+
readonly description: "Page down";
|
|
96
|
+
};
|
|
97
|
+
readonly "tui.editor.deleteCharBackward": {
|
|
98
|
+
readonly defaultKeys: "backspace";
|
|
99
|
+
readonly description: "Delete character backward";
|
|
100
|
+
};
|
|
101
|
+
readonly "tui.editor.deleteCharForward": {
|
|
102
|
+
readonly defaultKeys: ["delete", "ctrl+d"];
|
|
103
|
+
readonly description: "Delete character forward";
|
|
104
|
+
};
|
|
105
|
+
readonly "tui.editor.deleteWordBackward": {
|
|
106
|
+
readonly defaultKeys: ["ctrl+w", "alt+backspace", "ctrl+backspace", "super+alt+backspace"];
|
|
107
|
+
readonly description: "Delete word backward";
|
|
108
|
+
};
|
|
109
|
+
readonly "tui.editor.deleteWordForward": {
|
|
110
|
+
readonly defaultKeys: ["alt+delete", "alt+d", "super+alt+delete", "super+alt+d"];
|
|
111
|
+
readonly description: "Delete word forward";
|
|
112
|
+
};
|
|
113
|
+
readonly "tui.editor.deleteToLineStart": {
|
|
114
|
+
readonly defaultKeys: "ctrl+u";
|
|
115
|
+
readonly description: "Delete to line start";
|
|
116
|
+
};
|
|
117
|
+
readonly "tui.editor.deleteToLineEnd": {
|
|
118
|
+
readonly defaultKeys: "ctrl+k";
|
|
119
|
+
readonly description: "Delete to line end";
|
|
120
|
+
};
|
|
121
|
+
readonly "tui.editor.yank": {
|
|
122
|
+
readonly defaultKeys: "ctrl+y";
|
|
123
|
+
readonly description: "Yank";
|
|
124
|
+
};
|
|
125
|
+
readonly "tui.editor.yankPop": {
|
|
126
|
+
readonly defaultKeys: "alt+y";
|
|
127
|
+
readonly description: "Yank pop";
|
|
128
|
+
};
|
|
129
|
+
readonly "tui.editor.undo": {
|
|
130
|
+
readonly defaultKeys: ["ctrl+-", "ctrl+_"];
|
|
131
|
+
readonly description: "Undo";
|
|
132
|
+
};
|
|
133
|
+
readonly "tui.editor.spellingSuggestions": {
|
|
134
|
+
readonly defaultKeys: "ctrl+.";
|
|
135
|
+
readonly description: "Show spelling replacements";
|
|
136
|
+
};
|
|
137
|
+
readonly "tui.input.newLine": {
|
|
138
|
+
readonly defaultKeys: ["shift+enter", "ctrl+j"];
|
|
139
|
+
readonly description: "Insert newline";
|
|
140
|
+
};
|
|
141
|
+
readonly "tui.input.submit": {
|
|
142
|
+
readonly defaultKeys: "enter";
|
|
143
|
+
readonly description: "Submit input";
|
|
144
|
+
};
|
|
145
|
+
readonly "tui.input.tab": {
|
|
146
|
+
readonly defaultKeys: "tab";
|
|
147
|
+
readonly description: "Tab / autocomplete";
|
|
148
|
+
};
|
|
149
|
+
readonly "tui.input.copy": {
|
|
150
|
+
readonly defaultKeys: "ctrl+c";
|
|
151
|
+
readonly description: "Copy selection";
|
|
152
|
+
};
|
|
153
|
+
readonly "tui.select.up": {
|
|
154
|
+
readonly defaultKeys: "up";
|
|
155
|
+
readonly description: "Move selection up";
|
|
156
|
+
};
|
|
157
|
+
readonly "tui.select.down": {
|
|
158
|
+
readonly defaultKeys: "down";
|
|
159
|
+
readonly description: "Move selection down";
|
|
160
|
+
};
|
|
161
|
+
readonly "tui.select.pageUp": {
|
|
162
|
+
readonly defaultKeys: "pageUp";
|
|
163
|
+
readonly description: "Selection page up";
|
|
164
|
+
};
|
|
165
|
+
readonly "tui.select.pageDown": {
|
|
166
|
+
readonly defaultKeys: "pageDown";
|
|
167
|
+
readonly description: "Selection page down";
|
|
168
|
+
};
|
|
169
|
+
readonly "tui.select.confirm": {
|
|
170
|
+
readonly defaultKeys: "enter";
|
|
171
|
+
readonly description: "Confirm selection";
|
|
172
|
+
};
|
|
173
|
+
readonly "tui.select.cancel": {
|
|
174
|
+
readonly defaultKeys: ["escape", "ctrl+c"];
|
|
175
|
+
readonly description: "Cancel selection";
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
export interface KeybindingConflict {
|
|
179
|
+
key: KeyId;
|
|
180
|
+
keybindings: string[];
|
|
181
|
+
}
|
|
182
|
+
export declare function canonicalKeyId(key: string): string;
|
|
183
|
+
export declare function addKeyAliases(keys: Set<string>, key: KeyId): void;
|
|
184
|
+
export declare class KeybindingsManager {
|
|
185
|
+
#private;
|
|
186
|
+
constructor(definitions: KeybindingDefinitions, userBindings?: KeybindingsConfig);
|
|
187
|
+
matches(data: string, keybinding: Keybinding): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Set-lookup variant of {@link matches} for hot input paths: the caller
|
|
190
|
+
* parses `data` once (`parseKey` + `canonicalKeyId`) and probes many
|
|
191
|
+
* bindings without re-parsing the raw sequence per probe.
|
|
192
|
+
*/
|
|
193
|
+
matchesCanonical(canonical: string | undefined, keybinding: Keybinding): boolean;
|
|
194
|
+
getKeys(keybinding: Keybinding): KeyId[];
|
|
195
|
+
getDefinition(keybinding: Keybinding): KeybindingDefinition;
|
|
196
|
+
getConflicts(): KeybindingConflict[];
|
|
197
|
+
setUserBindings(userBindings: KeybindingsConfig): void;
|
|
198
|
+
getUserBindings(): KeybindingsConfig;
|
|
199
|
+
getResolvedBindings(): KeybindingsConfig;
|
|
200
|
+
}
|
|
201
|
+
export declare function setKeybindings(keybindings: KeybindingsManager): void;
|
|
202
|
+
export declare function getKeybindings(): KeybindingsManager;
|