moveRight function
Implementation
NavigationResult moveRight(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 newStop = _stopAtFlatIndex(lines, idx + 1);
if (newStop == null) return NavigationResult.none;
return NavigationResult(position: newStop, preferredX: 0.0);
}
if (idx >= stops_.length - 1) return NavigationResult.none;
final newStop = stops_[idx + 1];
return NavigationResult(position: newStop, preferredX: 0.0);
}