moveToLineEnd function
Moves the cursor to the end of the current logical line.
Implementation
NavigationResult moveToLineEnd(
Root root,
CaretStop current, {
List<LogicalLine>? lines,
}) {
final lines_ = lines ?? buildAllLogicalLines(root);
final lineInfo = findLineForStop(lines_, current);
if (lineInfo == null) return NavigationResult.none;
final line = lines_[lineInfo.lineIndex];
if (line.stops.isEmpty) return NavigationResult.none;
final lastStop = line.stops.last;
if (lastStop == current) return NavigationResult.none;
return NavigationResult(position: lastStop, preferredX: 0.0);
}