TerminalController class
The selection, highlights and pointer settings of a TerminalView.
Create one and pass it to TerminalView.controller to read or change
the selection, highlight ranges, or choose which pointer events reach
the program; listen to it to learn when the selection changes. Dispose
it when done (a view disposes only the controller it created itself).
final controller = TerminalController();
// TerminalView(terminal, controller: controller)
final range = controller.selection;
if (range != null) print(terminal.buffer.getText(range));
While a TerminalView shows it, selection is the selection on the
screen, including the one the user makes with the mouse, and
setSelection, setSelectionMode and clearSelection change it.
Use one controller per view.
- Mixed-in types
Constructors
- TerminalController({SelectionMode selectionMode = SelectionMode.line, PointerInputs pointerInputs = const PointerInputs({PointerInput.tap}), bool suspendPointerInput = false})
- A controller with the given selection mode and pointer settings.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
highlights
→ List<
TerminalHighlight> -
The live highlights, in creation order (see highlight).
no setter
- 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
- selection → BufferRange?
-
The selected range, or
nullwhen nothing is selected (or the anchors of the selection left the buffer). Its end is exclusive, as in xterm: a selection of one cell at (x, y) ends at (x + 1, y).no setter - selectionMode → SelectionMode
-
How selections cover cells: running text (SelectionMode.line, the
default) or a rectangle (SelectionMode.block). A view also makes a
plain mouse drag select a rectangle in SelectionMode.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
-
clearSelection(
) → void - Clears the current selection.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
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. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setPointerInputs(
PointerInputs pointerInput) → void - Selects which pointer events are reported to the program while it tracks the mouse.
-
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 -
Turns reporting pointer events to the program off (
true) or back on. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited