Skip to content

TextAreaEditor

Category: Input

Source: text_area_editor.dart

Classes

TextAreaEditor

A multiline text editor with history, word-level movement, and standard Emacs-like keybindings.

Drop-in replacement for [LineEditor] — exposes the same public API (text, cursor, isEmpty, lastSubmitted, history, handle(), clear(), setText()) plus multiline getters (lines, cursorRow, cursorCol).

Properties

PropertyTypeDescription
textString getThe current text as a flat string (lines joined by \n).
isEmptybool getWhether the editor is empty.
lastSubmittedString getThe text from the most recent submit.
historyList<String> getThe input history (read-only).
linesList<String> getThe logical lines of text.
cursorRowint getThe cursor's row (0-indexed into [lines]).
cursorColint getThe cursor's column (0-indexed into the current line).
isMultilinebool getWhether the editor contains multiple lines.
textString getThe current text as a flat string (lines joined by \n).
cursorint getThe cursor as a flat character offset (for autocomplete compatibility).
isEmptybool getWhether the editor is empty.
lastSubmittedString getThe text from the most recent submit.
historyList<String> getThe input history (read-only).
linesList<String> getThe logical lines of text.
cursorRowint getThe cursor's row (0-indexed into [lines]).
cursorColint getThe cursor's column (0-indexed into the current line).
isMultilinebool getWhether the editor contains multiple lines.

Methods

InputAction? handle(TerminalEvent event)

Process a [TerminalEvent] and return the resulting action, or null if the event was not consumed.

void clear()

Clear the buffer and reset cursor position.

void setText(String text, {int? cursor})

Programmatically set the buffer text and cursor position.

Used by autocomplete to accept a completion. The [cursor] parameter is a flat offset (same convention as LineEditor).

Released under the MIT License.