utils/cursor_navigation
library
Classes
-
CaretStop
-
A position reachable by the cursor in the document.
-
LogicalLine
-
Represents a "logical line" of the document.
-
NavigationResult
-
Result of a cursor movement.
position is the new position (null = no movement possible).
preferredX is the x coordinate to preserve for subsequent Up/Down.
Functions
-
buildAllLogicalLines(Root root)
→ List<LogicalLine>
-
Returns all LogicalLines of the document, in reading order.
-
buildAllStops(Root root)
→ List<CaretStop>
-
Generates the flat list of ALL CaretStop in the document, in reading
order. This is the "rail" on which Left/Right move.
-
findLineForStop(List<LogicalLine> lines, CaretStop stop)
→ ({int lineIndex, int stopIndexInLine})?
-
-
findStopIndex(List<CaretStop> stops, String fragmentId, int offset)
→ int
-
-
moveDown(Root root, CaretStop current, double preferredX, CaretXResolver resolveX, CaretYResolver resolveY, {List<CaretStop>? stops})
→ NavigationResult
-
Moves the cursor down by one LogicalLine.
-
moveLeft(Root root, CaretStop current, {List<CaretStop>? stops, List<LogicalLine>? cachedLines})
→ NavigationResult
-
-
movePageDown(Root root, CaretStop current, double preferredX, CaretXResolver resolveX, CaretYResolver resolveY, {List<LogicalLine>? lines})
→ NavigationResult
-
Moves the cursor down by approximately 10-15 logical lines.
-
movePageUp(Root root, CaretStop current, double preferredX, CaretXResolver resolveX, CaretYResolver resolveY, {List<LogicalLine>? lines})
→ NavigationResult
-
Moves the cursor up by approximately 10-15 logical lines.
-
moveRight(Root root, CaretStop current, {List<CaretStop>? stops, List<LogicalLine>? cachedLines})
→ NavigationResult
-
-
moveToLineEnd(Root root, CaretStop current, {List<LogicalLine>? lines})
→ NavigationResult
-
Moves the cursor to the end of the current logical line.
-
moveToLineStart(Root root, CaretStop current, {List<LogicalLine>? lines})
→ NavigationResult
-
Moves the cursor to the start of the current logical line.
If
lines is provided (e.g. from a document cache), it is used directly
instead of rebuilding the entire tree with buildAllLogicalLines(root).
-
moveUp(Root root, CaretStop current, double preferredX, CaretXResolver resolveX, CaretYResolver resolveY, {List<CaretStop>? stops})
→ NavigationResult
-
Moves the cursor up by one LogicalLine.
preferredX is the x coordinate in pixels to maintain.
If it's -1.0, it's calculated from the current position via resolveX.
-
moveWordLeft(Root root, CaretStop current, {List<CaretStop>? stops, List<LogicalLine>? cachedLines})
→ NavigationResult
-
-
moveWordRight(Root root, CaretStop current, {List<CaretStop>? stops, List<LogicalLine>? cachedLines})
→ NavigationResult
-