TerminalController class
State controller for TerminalView: owns search, selection, highlights and pointer-input configuration. Extends ChangeNotifier so widgets rebuild when any of these change.
- Mixed-in types
Constructors
- TerminalController({SelectionMode selectionMode = SelectionMode.line, PointerInputs pointerInputs = const PointerInputs({PointerInput.tap}), bool suspendPointerInput = false})
- Creates a controller with the given selection mode, pointer inputs and pointer suspension state.
Properties
- currentSearchIndex → int
-
The index of the current search result (0-based).
-1 if no result is selected.
no setter
- currentSearchResult → BufferRange?
-
The current search result, or null if no result is selected.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasSearchResults → bool
-
Whether there are any search results.
no setter
-
highlights
→ List<
TerminalHighlight> -
All active highlights, as an unmodifiable list.
no setter
- isSearching → bool
-
Whether a search is currently active.
no setter
- onCreateAnchor ↔ CreateAnchorCallback?
-
Callback to create a cell anchor from a buffer offset.
getter/setter pair
- onGetText ↔ SearchCallback?
-
Callback to get the terminal buffer text for searching.
getter/setter pair
- pointerInput → PointerInputs
-
The set of pointer events which will be used as mouse input for the terminal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
searchOptions
→ Set<
SearchOption> -
Current search options.
no setter
- searchPattern → String?
-
The current search pattern.
no setter
- searchResultCount → int
-
Number of search results.
no setter
-
searchResults
→ List<
BufferRange> -
All search results matching the current pattern.
no setter
- selection → BufferRange?
-
The current selection as a range, or null when there is no selection or
the selection anchors are detached.
no setter
- selectionMode → SelectionMode
-
The current selection mode (line or block).
no setter
- suspendedPointerInputs → bool
-
True if sending pointer events to the terminal is suspended.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearSearch(
) → void - Clears the current search but keeps search mode active.
-
clearSelection(
) → void - Clears the current selection.
-
closeSearch(
) → void - Closes the search UI and clears the search state.
-
consumePasteFromShortcut(
) → bool - Returns true if a paste was recently triggered by shortcut, consuming one pending count.
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
getSearchResultAt(
int index) → BufferRange? -
Gets the search result at
index. -
highlight(
{required CellAnchor p1, required CellAnchor p2, required Color color}) → TerminalHighlight -
Creates a new highlight on the terminal from
p1top2with the givencolor. The highlight will be removed when the returned object is disposed. -
markPasteFromShortcut(
) → void - Marks that a paste was triggered by keyboard shortcut.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
openSearch(
) → void - Opens the search UI (called when user activates search mode).
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
search(
String pattern) → void -
Performs a search for
patternin the terminal buffer. -
searchNext(
) → void - Moves to the next search result.
-
searchPrevious(
) → void - Moves to the previous search result.
-
setPointerInputs(
PointerInputs pointerInput) → void - Selects which types of pointer events are sent to the terminal.
-
setSearchOptions(
Set< SearchOption> options) → void - Sets the search options.
-
setSelection(
CellAnchor base, CellAnchor extent, {SelectionMode? mode}) → void -
Set selection on the terminal from
basetoextent. This method takes the ownership ofbaseandextentand will dispose them when the selection is cleared or changed. -
setSelectionMode(
SelectionMode newSelectionMode) → void - Controls how the terminal behaves when the user selects a range of text. The default is SelectionMode.line. Setting this to SelectionMode.block enables block selection mode.
-
setSuspendPointerInput(
bool suspend) → void - Toggles whether pointer events are sent to the terminal.
-
toggleSearchOption(
SearchOption option) → void - Toggles a search option.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited