Skip to content

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

PropertyTypeDescription
textString getThe current text content of the editor.
cursorint getThe cursor position (character offset into [text]).
isEmptybool getWhether the editor is empty.
lastSubmittedString getThe text from the most recent submit (available after [InputAction.submit]).
historyList<String> getThe input history (read-only).
textString getThe current text content of the editor.
cursorint getThe cursor position (character offset into [text]).
isEmptybool getWhether the editor is empty.
lastSubmittedString getThe text from the most recent submit (available after [InputAction.submit]).
historyList<String> getThe 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.

Released under the MIT License.