TextAreaModel class

Inheritance

Constructors

TextAreaModel({String prompt = '│ ', String placeholder = '', bool showLineNumbers = true, int minimumLineNumberDigits = 0, int charLimit = 0, bool softWrap = true, int width = 0, int height = 6, bool useVirtualCursor = true, TextAreaKeyMap? keyMap, CursorModel? cursor, TextAreaStyles? styles, DateTime nowProvider()?})

Properties

activeCodeAction → EditorCodeAction?
no setter
activeCompletion → EditorCompletionItem?
no setter
activeDiagnostic → TextDiagnosticRange?
no setter
activeSearchMatch → TextSearchMatch?
no setter
canRedo → bool
no setter
canUndo → bool
no setter
charLimit ↔ int
getter/setter pair
codeActionError → Object?
no setter
codeActionIndex → int
no setter
codeActions → List<EditorCodeAction>
no setter
column → int
no setter
commandRegistry → EditorCommandRegistry<TextAreaModel>
Commands available to keymaps, palettes, and host integrations.
no setter
completionError → Object?
no setter
completionIndex → int
no setter
completionItems → List<EditorCompletionItem>
Current completion candidates.
no setter
completionVisible → bool
no setter
cursor ↔ CursorModel
Cursor model.
getter/setter pair
cursorOffset → int
Cursor offset in graphemes from the document start.
no setter
decorations → List<TextDecorationRange>
no setter
diagnostics → List<TextDiagnosticRange>
no setter
document → TextDocument
no setter
editorState → EditorState
no setter
focused → bool
no setter
folds ↔ FoldState
Fold projection applied by TextView. Hidden lines are not painted.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hasMultipleSelections → bool
Whether more than one cursor or selection is active.
no setter
hasSelection → bool
no setter
height → int
no setter
isDirty → bool
no setter
keyMap ↔ TextAreaKeyMap
getter/setter pair
length → int
no setter
line → int
no setter
lineCount → int
no setter
lineDecorations → List<TextLineDecoration>
no setter
minimumLineNumberDigits ↔ int
Minimum width reserved for line numbers.
getter/setter pair
placeholder ↔ String
getter/setter pair
prompt ↔ String
getter/setter pair
promptFunc ↔ PromptFunc?
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
searchError → String?
no setter
searchMatches → List<TextSearchMatch>
no setter
searchMatchIndex → int
no setter
searchQuery → TextSearchQuery?
no setter
searchTruncated → bool
Whether the current search stopped at EditorWorkBudget.maxSearchResults.
no setter
selectionBase → ({int column, int line})?
Anchor position of the current selection, if any.
no setter
selectionExtent → ({int column, int line})?
Active extent position of the current selection, if any.
no setter
selections → TextSelectionSet
Active normalized selections. A single legacy cursor is returned when multi-cursor mode is inactive.
no setter
showLineNumbers ↔ bool
getter/setter pair
softWrap ↔ bool
getter/setter pair
styles ↔ TextAreaStyles
Styles for the textarea.
getter/setter pair
terminalCursor → Cursor?
Returns a Cursor for rendering a real cursor in a TUI program. This requires that useVirtualCursor is set to false.
no setter
useVirtualCursor ↔ bool
Whether to use a virtual cursor. If false, use terminalCursor to return a real cursor for rendering.
getter/setter pair
value ↔ String
Returns the current value of the textarea.
getter/setter pair
width → int
no setter
workAssessment → EditorWorkAssessment
Feature recommendations for the current document.
no setter
workBudget ↔ EditorWorkBudget
Limits for search, decorations, completions, and syntax work.
getter/setter pair

Methods

acceptCodeAction() → bool
Accepts an action for the host to dispatch/apply exactly once.
acceptCompletion() → bool
Accepts the active completion as one normal undo transaction.
activeStyle() → TextAreaStyleState
Returns the appropriate style state based on focus.
addCursorAtOffset(int offset) → void
Adds a collapsed cursor at offset and makes it primary.
addCursorVertically({required bool below}) → bool
Adds a cursor on the adjacent document line at the primary visual column.
addNextOccurrence() → bool
Adds the next occurrence of the primary selected text.
applyTextCommandResult(TextCommandResult result, {bool pushHistoryBoundary = false}) → void
Applies an offset-based command result to the live document state.
applyTextCursorCommandResult(TextCursorCommandResult result, {bool pushHistoryBoundary = false}) → void
Applies an offset cursor command result to the live document state.
applyTextLineCommandResult(TextLineCommandResult result, {bool pushHistoryBoundary = false}) → void
Applies a line-based command result to the live document state.
blur() → void
Blurs the textarea.
cancelCodeActions() → void
cancelCompletions() → void
Hides candidates and invalidates any in-flight provider response.
capitalizeSelectionOrLine() → bool
Capitalizes words in the selected range, or the current line when there is no selection.
capitalizeWordForward() → bool
Capitalizes the word at or after the cursor.
cleanupWhitespace({bool trimTrailingBlankLines = true}) → bool
Cleans up trailing horizontal whitespace in the selected block, or the entire buffer when there is no selection.
clearDecorationLayer(String layerKey) → bool
clearDecorations() → bool
clearDiagnostics() → bool
clearHighlights() → bool
clearHistory() → void
Clears all undo and redo history.
clearLineDecorationLayer(String layerKey) → bool
clearLineDecorations() → bool
clearSelection() → void
Clears the current selection.
clearSyntax() → bool
Removes syntax decorations while preserving every other layer.
closeSearch() → void
Closes the search session and removes only its highlight layer.
collapseAllFolds() → bool
Collapses every fold range.
consumeAcceptedCodeAction() → EditorCodeAction?
consumeCompletionAdditionalEdits() → WorkspaceEdit?
Additional edits from the last accepted completion, consumed once.
consumeLastDocumentChange() → TextDocumentChange?
cursorColumn() → int
Returns the current cursor column (0-indexed).
cursorEnd() → void
cursorLine() → int
Returns the current cursor line (0-indexed).
cursorStart() → void
cutSelectedText() → String
Returns selected text and removes every selection atomically.
decorationsForLayer(String layerKey) → List<TextDecorationRange>
deleteAtSelections({required bool forward}) → bool
Deletes one grapheme beside every cursor, or each selected range.
deleteLines() → bool
Deletes the selected lines, or the current line if there is no selection.
deleteLinesAtSelections() → bool
Deletes every line touched by an active cursor or selection.
deleteSelections() → bool
Deletes all active selections as one undoable edit.
deleteToLineBoundaryAtSelections({required bool forward}) → bool
Deletes from every cursor to its logical line boundary atomically.
deleteWordAtSelections({required bool forward}) → bool
Deletes to a word boundary beside every cursor as one undoable edit.
duplicateLinesAbove() → bool
Duplicates the selected lines, or the current line, above the current block and moves the selection/cursor to the duplicate.
duplicateLinesAtSelections() → bool
Duplicates every touched line below the original.
duplicateLinesBelow() → bool
Duplicates the selected lines, or the current line, below the current block and moves the selection/cursor to the duplicate.
editTransaction<T>(T body(TextAreaModel model)) → T
Runs every edit invoked by body as one undoable transaction.
executeCommand(String commandId, {Object? argument}) → EditorCommandDispatchResult
Dispatches a stable editor command against this model.
expandAllFolds() → bool
Expands every fold range.
extendSelectionsByPage({required bool below}) → bool
Extends every selection's active edge by one viewport page.
extendSelectionsByWord({required bool forward}) → bool
Extends every selection's end by one word.
extendSelectionsHorizontally({required bool forward}) → bool
Extends every selection's end by one grapheme.
extendSelectionsToDocumentBoundary({required bool forward}) → bool
Extends every selection's active edge to a document boundary.
extendSelectionsToLineBoundary({required bool forward}) → bool
Extends every selection's end to its line boundary.
extendSelectionsToVisualLineBoundary({required bool forward}) → bool
Extends every selection's active edge to its visual-row boundary.
extendSelectionsVertically({required bool below}) → bool
Extends every selection's end up or down by one visible line.
focus() → Cmd?
Focuses the textarea.
getSelectedText() → String
Returns the currently selected text.
getSelectedTexts() → List<String>
Selected text for each non-collapsed range in document order.
indentAtSelections({int width = 2}) → bool
Indents every line touched by an active cursor or selection.
indentLines({int width = 2}) → bool
Indents the selected lines, or the current line if there is no selection.
init() → Cmd?
Returns an optional command to execute on program startup.
override
insertString(String s) → void
isFocused() → bool
Returns whether the textarea is focused.
joinLines() → bool
Joins the current line with the next line, or joins the selected block into a single line.
lineAt(int i) → String
Returns the text of the line at the given index.
lineDecorationsForLayer(String layerKey) → List<TextLineDecoration>
lowercaseSelectionOrLine() → bool
Lowercases the selected range, or the current line when there is no selection.
lowercaseWordForward() → bool
Lowercases the word at or after the cursor.
markSaved() → void
Marks the current value as the persisted baseline.
moveCodeActionSelection(int delta) → bool
moveCompletionSelection(int delta) → bool
Moves the active completion by delta, wrapping at either end.
moveLinesAtSelections({required bool down}) → bool
Moves every touched line up or down by one row, keeping contiguous runs together.
moveLinesDown() → bool
Moves the selected lines, or the current line, one row downward.
moveLinesUp() → bool
Moves the selected lines, or the current line, one row upward.
moveSelectionsByPage({required bool below}) → bool
Moves every active cursor by one viewport page.
moveSelectionsByWord({required bool forward}) → bool
Moves every active cursor to the next or previous word boundary.
moveSelectionsHorizontally({required bool forward}) → bool
Moves every active cursor left or right by one grapheme.
moveSelectionsToLineBoundary({required bool forward}) → bool
Moves every active cursor to the start or end of its logical line.
moveSelectionsToVisualLineBoundary({required bool forward}) → bool
Moves every active cursor to its projected visual-row boundary.
moveSelectionsVertically({required bool below}) → bool
Moves every active cursor up or down by one visible line.
moveToDocumentEnd() → bool
Moves the primary cursor to the end of the document.
moveToDocumentStart() → bool
Moves the primary cursor to the start of the document.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outdentAtSelections({int width = 2}) → bool
Outdents every line touched by an active cursor or selection.
outdentLines({int width = 2}) → bool
Outdents the selected lines, or the current line if there is no selection.
pushHistoryBoundary() → void
Breaks the current undo coalescing chain.
redo() → bool
Reapplies the most recently undone edit state.
refreshIndentFolds({int tabWidth = 4}) → void
Recomputes indent folds and keeps collapse state that still applies.
renumberNumberedList({int startAt = 1}) → bool
Renumbers existing numbered list items in the current line or selected block.
replaceActiveSearchMatch(String replacementTemplate) → bool
Replaces the active match and refreshes the current search.
replaceAllSearchMatches(String replacementTemplate) → bool
Replaces all current matches as one undoable edit.
requestCodeActions(EditorCodeActionProvider provider) → Cmd
Requests quick fixes/refactors for the current selection or cursor.
requestCompletions(EditorCompletionProvider provider, {String? trigger}) → Cmd
Starts an asynchronous completion request for the current document.
reset() → void
selectAll() → void
Selects the entire textarea contents.
selectCurrentLine() → void
Selects the current line, or expands the current selection to full lines.
selectDiagnosticAtLine(int lineIndex) → bool
selectNextDiagnostic({bool wrap = true}) → bool
selectPreviousDiagnostic({bool wrap = true}) → bool
selectSearchMatch({required bool forward, bool wrap = true}) → bool
Selects the next or previous search match.
setCharLimit(int n) → void
Sets the character limit.
setCursor(int row, int col) → void
Sets the cursor position.
setDecorationLayer(String layerKey, Iterable<TextDecorationRange> decorations, {int priority = textDefaultDecorationLayerPriority}) → bool
setDecorations(Iterable<TextDecorationRange> decorations) → bool
setDiagnostics(Iterable<TextDiagnosticRange> diagnostics) → bool
setDiagnosticsFromPositions(Iterable<TextPositionDiagnosticRange> diagnostics) → bool
setHeight(int h) → void
Sets the height of the textarea.
setHighlights(Iterable<TextHighlightRange> highlights, {int activeIndex = -1}) → bool
setLineDecorationLayer(String layerKey, Iterable<TextLineDecoration> decorations, {int priority = textDefaultLineDecorationLayerPriority}) → bool
setLineDecorations(Iterable<TextLineDecoration> decorations) → bool
setPlaceholder(String s) → void
Sets the placeholder text.
setPromptFunc(int promptWidth, PromptFunc fn) → void
Sets the prompt function.
setSelection({required int baseLine, required int baseColumn, required int extentLine, required int extentColumn}) → void
Sets the current selection and places the cursor at the extent.
setSelections(TextSelectionSet value) → void
Activates normalized multi-cursor selections in document coordinates.
setText(String v, {bool recordHistory = true}) → void
Replaces the text and collapses the cursor at the end.
setValue(String v) → void
Sets the value of the textarea (method form for API compatibility).
setWidth(int w) → void
Sets the width of the textarea.
sortSelectedLines({bool descending = false, bool caseSensitive = false}) → bool
Sorts the selected lines, or the entire buffer when there is no selection.
splitLine() → bool
Splits the current line at the cursor, or replaces the selected range with a newline and places the cursor at the start of the new line.
startSearch(TextSearchQuery query) → TextSearchResult
Starts or incrementally refreshes a grapheme-aware search session.
syncSyntax<State>(TextSyntaxSession<State> session, {String? language, bool force = false}) → TextSyntaxSnapshot<State>
Incrementally synchronizes session and updates the dedicated syntax decoration layer without disturbing search or diagnostics.
syncSyntaxAsync<State>(AsyncTextSyntaxSession<State> session, {String? language, bool force = false}) → Future<TextSyntaxSnapshot<State>?>
Asynchronously synchronizes syntax without publishing stale results.
toggleChecklistState({String checkedMarker = 'x'}) → bool
Toggles checklist completion state on the current line or selected block.
toggleFoldAtCursor() → bool
Toggles the fold at the primary cursor, moving onto the header if hidden.
toggleHeadingPrefix({int level = 1}) → bool
Toggles Markdown heading prefixes on the current line or selected block.
toggleLinePrefix(String prefix, {bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → bool
Toggles prefix on the current line or selected block.
toggleNumberedList({int startAt = 1}) → bool
Toggles numbered list prefixes on the current line or selected block.
toString() → String
A string representation of this object.
inherited
transposeCharactersBackward() → bool
Transposes the grapheme before the cursor with its predecessor.
undo() → bool
Restores the most recent previous edit state.
unwrapSelection() → bool
Removes a matching surrounding delimiter pair around the current selection and preserves the inner selection.
update(Msg msg) → (TextAreaModel, Cmd?)
Updates the component state in response to a message.
override
uppercaseSelectionOrLine() → bool
Uppercases the selected range, or the current line when there is no selection.
uppercaseWordForward() → bool
Uppercases the word at or after the cursor.
view() → Object
Renders the current model state for display.
override
wrapSelection(String before, {String? after}) → bool
Wraps the current selection with before and after.

Operators

operator ==(Object other) → bool
The equality operator.
inherited