ui/CommandHistory¶
Classes¶
CommandHistory¶
Defined in: ui/CommandHistory.ts:14
CommandHistory - the console's persisted command history with up/down-arrow navigation, extracted from Console so the navigation semantics are testable without a DOM.
Navigation model: a null index means "fresh input line". previous() walks toward older commands and sticks at the oldest (no cycling); next() walks toward newer commands and finally returns to the fresh line (empty string).
Constructors¶
Constructor¶
Defined in: ui/CommandHistory.ts:18
Parameters¶
storageKey?¶
string = 'console-command-history'
maxEntries?¶
number = 100
Returns¶
Accessors¶
entries¶
Get Signature¶
Defined in: ui/CommandHistory.ts:87
Returns¶
readonly string[]
Methods¶
load()¶
Defined in: ui/CommandHistory.ts:24
Load persisted history from localStorage.
Returns¶
void
add()¶
Defined in: ui/CommandHistory.ts:33
Append a command (newest last), cap the size, and persist.
Parameters¶
command¶
string
Returns¶
void
previous()¶
Defined in: ui/CommandHistory.ts:47
Step to the previous (older) command. Returns the command to show, or null when there is no history to navigate.
Returns¶
string | null
next()¶
Defined in: ui/CommandHistory.ts:67
Step to the next (newer) command. Returns the command to show, '' when stepping past the newest back to the fresh input line, or null when not currently navigating.
Returns¶
string | null
resetNavigation()¶
Defined in: ui/CommandHistory.ts:83
Return to the fresh-input state (e.g. after submitting a command).
Returns¶
void