TerminalController class

View-model layer between the TerminalEngine and the widget tree.

Hosts state that was previously inline on the screen widget's state (selection presence, primary-selection text, current search pattern and its validity) and notifies listeners on every transition so the view can rebuild the relevant slice without owning the state directly.

Lifecycle: the widget constructs a controller, calls attach once with its TerminalEngine, and calls dispose when tearing down. The controller does NOT own the engine — disposal drops only its own ChangeNotifier machinery and the engine reference; the widget remains responsible for engine.dispose().

UI-only state (e.g. search-bar visibility) stays on the widget; only engine-coupled state lives here.

Inheritance

Constructors

TerminalController()

Properties

engine TerminalEngine?
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
primary String
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchPattern String
no setter
searchValid bool
no setter
selectionActive bool
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
attach(TerminalEngine engine) → void
Wire the controller to an engine. One-shot: re-attach without an intervening dispose is a programmer error.
capturePrimary() → void
Snapshot the current engine selection into primary. Notifies only on change so a redundant capture (e.g. tap after a tap) doesn't churn the listener chain.
clearSelection() → void
Gated to match alacritty event.rs:clear_selection — the FFI hop + full snapshot are skipped when there's nothing to clear.
dispose() → void
Discards any resources used by the object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onTerminalInputStart() → void
Mirror of alacritty event.rs:on_terminal_input_start. Call this from every "user just typed / pasted / dropped" entry point — the gates ensure no FFI snapshot fires when there's nothing to clear and the viewport is already at the bottom (this is the Plan 2L perf fix).
readSelectionText() String?
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
scrollLines(int delta) Future<void>
scrollToBottom() Future<void>
searchClear() → void
Gated: no-op when nothing is set. Prevents redundant engine work when the search bar is closed without ever having been used.
searchNext() → void
searchPrev() → void
searchSet(String pattern) bool
Push a new pattern into the engine. Returns the engine's compile result; an empty pattern is always reported as valid (matches the UI's behavior for "no pattern → no error indicator").
selectionStart(int row, int col, bool rightHalf, int kind) → void
selectionUpdate(int row, int col, bool rightHalf) → void
toString() String
A string representation of this object.
inherited

Operators

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