findLineForStop function

({int lineIndex, int stopIndexInLine})? findLineForStop(
  1. List<LogicalLine> lines,
  2. CaretStop stop
)

Implementation

({int lineIndex, int stopIndexInLine})? findLineForStop(
  List<LogicalLine> lines,
  CaretStop stop,
) {
  for (int i = 0; i < lines.length; i++) {
    final idx = lines[i].indexOf(stop);
    if (idx >= 0) return (lineIndex: i, stopIndexInLine: idx);
  }
  return null;
}