LineEditor
Category: Input
Source: line_editor.dart
Enums
InputAction
Actions that the line editor signals back to its owner.
Classes
LineEditor
A readline-style line editor with history, word-level movement, and standard Emacs-like keybindings.
Sits at the bottom of the TUI and processes [TerminalEvent]s into [InputAction]s. The owning widget uses [text] and [cursor] to render the current state.
Properties
| Property | Type | Description |
|---|---|---|
text | String get | The current text content of the editor. |
cursor | int get | The cursor position (character offset into [text]). |
isEmpty | bool get | Whether the editor is empty. |
lastSubmitted | String get | The text from the most recent submit (available after [InputAction.submit]). |
history | List<String> get | The input history (read-only). |
text | String get | The current text content of the editor. |
cursor | int get | The cursor position (character offset into [text]). |
isEmpty | bool get | Whether the editor is empty. |
lastSubmitted | String get | The text from the most recent submit (available after [InputAction.submit]). |
history | List<String> get | The input history (read-only). |
Methods
InputAction? handle(TerminalEvent event)
Processes a [TerminalEvent] and returns the resulting action, or null if the event was not consumed.
void clear()
Clears the buffer and resets the cursor position.
void setText(String text, {int? cursor})
Programmatically sets the buffer text and cursor position.
Used by autocomplete to accept a completion.