moveLeft function
Implementation
NavigationResult moveLeft(Root root, CaretStop current, {
List<CaretStop>? stops,
List<LogicalLine>? cachedLines,
}) {
final stops_ = stops ?? buildAllStops(root);
int idx = findStopIndex(stops_, current.fragmentId, current.offset);
if (idx < 0) {
final lines = cachedLines ?? buildAllLogicalLines(root);
idx = _findStopIndexInLines(lines, current.fragmentId, current.offset);
if (idx <= 0) return NavigationResult.none;
final stopsFromLines = lines.expand((l) => l.stops).toList();
final newStop = stopsFromLines[idx - 1];
return NavigationResult(position: newStop, preferredX: 0.0);
}
if (idx <= 0) return NavigationResult.none;
final newStop = stops_[idx - 1];
return NavigationResult(position: newStop, preferredX: 0.0);
}