HistoryCursor class

A reusable Up/Down navigation cursor over a CommandHistoryBuffer.

Holds the browsing state the CLI's LineEditor and the web client's shell host both need: the current index into the entries (== length while editing a fresh line), the in-progress line stashed aside while browsing, and the prefix that restricts which entries Up/Down visit.

The cursor never touches the caller's line buffer; up/down return the text to display (or null to leave the current line unchanged), keeping it agnostic to how the host stores and renders the line.

Constructors

HistoryCursor(CommandHistoryBuffer _history)
Creates a cursor positioned past the newest entry (fresh-line state).

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

down() String?
Moves to the next (newer) matching entry, returning the line to show. Past the most recent match it restores the stashed in-progress line. Returns null when already on the fresh line.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets browsing so the next up recomputes the prefix from the current input. Call after any edit to the line and after recording a command.
toString() String
A string representation of this object.
inherited
up({required String line, required String prefix}) String?
Moves to the previous (older) entry matching the active prefix, returning the line to show or null to leave the current line unchanged.

Operators

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