ui/consoleTokens¶
Interfaces¶
InputToken¶
Defined in: ui/consoleTokens.ts:10
Pure helpers for locating the cursor inside console input, extracted from Console so the token/argument math is testable without a DOM. Separators are whitespace and commas (CRE uses the comma form).
Properties¶
text¶
Defined in: ui/consoleTokens.ts:11
start¶
Defined in: ui/consoleTokens.ts:12
end¶
Defined in: ui/consoleTokens.ts:13
ArgAtCursor¶
Defined in: ui/consoleTokens.ts:16
Properties¶
currentArgIndex¶
Defined in: ui/consoleTokens.ts:21
0-based index into the command's parameter list: the command token itself is conceptually at index -1, the first real argument is 0.
partialText¶
Defined in: ui/consoleTokens.ts:23
Text of the token under the cursor; '' when on a separator run.
tokenStart¶
Defined in: ui/consoleTokens.ts:24
tokenEnd¶
Defined in: ui/consoleTokens.ts:25
parts¶
Defined in: ui/consoleTokens.ts:27
All token texts, command first.
AcidContext¶
Defined in: ui/consoleTokens.ts:30
Properties¶
partialAcid¶
Defined in: ui/consoleTokens.ts:31
isCreCommand¶
Defined in: ui/consoleTokens.ts:32
acidArgIndex¶
Defined in: ui/consoleTokens.ts:33
isMidInput¶
Defined in: ui/consoleTokens.ts:39
True when the cursor sits on a token followed by more command content - the user is editing an earlier slot rather than typing at the end. Used to keep the dropdown open even on an exact match.
TokenReplacement¶
Defined in: ui/consoleTokens.ts:105
Properties¶
value¶
Defined in: ui/consoleTokens.ts:106
cursor¶
Defined in: ui/consoleTokens.ts:107
PanContext¶
Defined in: ui/consoleTokens.ts:179
Properties¶
partialQuery¶
Defined in: ui/consoleTokens.ts:181
What the user has typed in PAN's first argument slot so far.
isMidInput¶
Defined in: ui/consoleTokens.ts:183
See AcidContext.isMidInput.
Functions¶
tokenizeInput()¶
Defined in: ui/consoleTokens.ts:47
Split console input into tokens, keeping the character range each token occupies so callers can locate the token under the cursor without re-scanning the string.
Parameters¶
value¶
string
Returns¶
getArgAtCursor()¶
Defined in: ui/consoleTokens.ts:68
Find which argument slot the cursor currently sits on, so dropdowns can react to the actual cursor position rather than assuming the cursor is at the end of the input. When the cursor is inside a separator run, partialText is empty and currentArgIndex is the slot that would be filled next.
Parameters¶
value¶
string
cursorPos¶
number
Returns¶
replaceToken()¶
Defined in: ui/consoleTokens.ts:116
Replace the token spanning [tokenStart, tokenEnd) with replacement.
At end-of-input a trailing space is appended so the user can keep
typing the next argument; mid-input the tail is left untouched. The
returned cursor sits right after the inserted text.
Parameters¶
value¶
string
tokenStart¶
number
tokenEnd¶
number
replacement¶
string
Returns¶
argStartIndex()¶
Defined in: ui/consoleTokens.ts:137
Find the character index in value where the argument at position
argIndex begins (the command token is at conceptual index -1).
Returns value.length when that argument hasn't been typed yet, so
callers can truncate-and-append in one step.
Parameters¶
value¶
string
argIndex¶
number
Returns¶
number
findAcidContext()¶
Defined in: ui/consoleTokens.ts:148
Check whether the cursor sits on an aircraft-ID parameter of the current command (per the cmddict signature). Returns the context for the ACID autocomplete dropdown, or null when the slot is not an acid parameter.
Parameters¶
value¶
string
cursorPos¶
number
cmddict¶
CommandDict | null
Returns¶
AcidContext | null
findPanContext()¶
Defined in: ui/consoleTokens.ts:192
Check whether the cursor sits on the first argument of a PAN command - the slot that accepts an aircraft ID, airport/waypoint ident, direction, or latitude. Returns null when the user appears to be typing coordinates (a purely numeric token) so the suggestion dropdown stays out of the way.
Parameters¶
value¶
string
cursorPos¶
number
Returns¶
PanContext | null