TextAreaModel class
Constructors
-
TextAreaModel({String prompt = '│ ', String placeholder = '', bool showLineNumbers = true, int charLimit = 0, bool softWrap = true, int width = 0, int height = 6, bool useVirtualCursor = true, TextAreaKeyMap? keyMap, CursorModel? cursor, TextAreaStyles? styles})
-
Methods
-
activeStyle()
→ TextAreaStyleState
-
Returns the appropriate style state based on focus.
-
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.
-
capitalizeSelectionOrLine()
→ bool
-
Capitalizes words in the selected range, or the current line when there
is no selection.
-
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.
-
consumeLastDocumentChange()
→ TextDocumentChange?
-
-
cursorColumn()
→ int
-
Returns the current cursor column (0-indexed).
-
cursorEnd()
→ void
-
-
cursorLine()
→ int
-
Returns the current cursor line (0-indexed).
-
cursorStart()
→ void
-
-
decorationsForLayer(String layerKey)
→ List<TextDecorationRange>
-
-
deleteLines()
→ bool
-
Deletes the selected lines, or the current line if there is no selection.
-
duplicateLinesAbove()
→ bool
-
Duplicates the selected lines, or the current line, above the current
block and moves the selection/cursor to the duplicate.
-
duplicateLinesBelow()
→ bool
-
Duplicates the selected lines, or the current line, below the current
block and moves the selection/cursor to the duplicate.
-
focus()
→ Cmd?
-
Focuses the textarea.
-
getSelectedText()
→ String
-
Returns the currently selected text.
-
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.
-
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.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
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.
-
renumberNumberedList({int startAt = 1})
→ bool
-
Renumbers existing numbered list items in the current line or selected
block.
-
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
-
-
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.
-
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.
-
toggleChecklistState({String checkedMarker = 'x'})
→ bool
-
Toggles checklist completion state on the current line or selected block.
-
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
-
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.
-
view()
→ Object
-
Renders the current model state for display.
override
-
wrapSelection(String before, {String? after})
→ bool
-
Wraps the current selection with
before and after.