TerminalSelectionController class

A controller that manages terminal cell selection state, supporting character/stream, word, line, and rectangular block/box selection modes, pane region clamping, virtual-scrollback coordinate offsets, wide-grapheme boundary snapping, unified OSC 8 + plain-text link resolution, and clipboard text extraction.

Implemented types

Properties

anchor → SelectionPoint?
The selection starting anchor point.
no setter
focus → SelectionPoint?
The current active selection focus point.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasSelection → bool
Whether there is currently an active selection with both anchor and focus.
no setter
isSelecting → bool
Whether a selection gesture has been initiated.
no setter
mode → SelectionMode
The active selection mode.
no setter
region → SelectionRegion?
The bounding selectable region, if confined to a sub-pane.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(void listener()) → void
Adds a listener to be notified when the state changes.
override
clearSelection() → void
Clears the current selection.
containsCell(int col, int row, {int topVirtualRow = 0, int leftVirtualCol = 0}) → bool
Returns whether the viewport cell at (col, row) (offset by topVirtualRow and leftVirtualCol) is currently selected.
dispose() → void
Disposes the controller, removing all listeners.
extractSelectedText(Buffer buffer, {bool includeHidden = true, int topVirtualRow = 0, int leftVirtualCol = 0}) → String
Extracts the text contained in the current selection from buffer.
extractText(Buffer buffer, {bool includeHidden = true, int topVirtualRow = 0, int leftVirtualCol = 0}) → String
Alias for extractSelectedText.
extractVirtualText(VirtualLineLookup lookup, {required int cols}) → String
Extracts selected text across lookup, joining soft-wrapped rows (isWrapped == true) without \n unless mode is SelectionMode.block.
isCellSelected(int x, int y, {int topVirtualRow = 0, int leftVirtualCol = 0}) → bool
Returns whether the viewport cell at ([x], [y]) (offset by topVirtualRow and leftVirtualCol) is currently selected.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Notifies all registered listeners of a change in selection state.
removeListener(void listener()) → void
Removes a previously registered listener.
override
selectWord(Buffer buffer, int col, int row, {SelectionRegion? region}) → void
Selects the contiguous word at (col, row) in buffer.
startSelection(int col, int row, {SelectionMode mode = SelectionMode.character, SelectionRegion? region}) → void
Begins a new selection starting at (col, row).
toString() → String
A string representation of this object.
inherited
updateSelection(int col, int row, {SelectionMode? mode}) → void
Updates the selection endpoint to (col, row).
updateWordSelection(Buffer buffer, int col, int row) → void
Extends a word-snapped selection from the initial _wordAnchor to the word at (col, row) in buffer, supporting forward, backward, and direction-reversed drags across wide graphemes.
visibleRowSpans(Buffer buffer, {int topVirtualRow = 0, int leftVirtualCol = 0}) → List<(int, int, int)>
Intersects the active selection with buffer's 0..width-1 by 0..height-1 viewport (starting at topVirtualRow and leftVirtualCol) and snaps wide-grapheme continuation ("") boundaries.

Operators

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

Static Methods

resolveLinkSpanAt({required VirtualLineLookup lookup, required int col, required int virtualRow}) → ResolvedTerminalLink?
Resolves a hyperlink span at ([col], [virtualRow]) across soft-wrapped rows in lookup, preferring contiguous OSC 8 uris spans first and falling back to plain-text http://, https://, and mailto: tokens.
resolveRegionForCell(Buffer buffer, int col, int row, {SelectionMode mode = SelectionMode.character}) → SelectionRegion?
Resolves the confining SelectionRegion for a pointer gesture starting at ([col], [row]) in buffer, or returns null when selection should span the full buffer unconstrained.
snapWideBounds(List<String> chars, int rowOffset, int colStart, int colEnd, {int minCol = 0, required int maxCol}) → (int, int)
Snaps (colStart, colEnd) outward across wide-grapheme continuation ("") cells within [minCol, maxCol].