rowForLine method

int? rowForLine(
  1. int file,
  2. int number, {
  3. bool oldSide = false,
})

Finds a visible one-based source line, or null if it is hidden.

Implementation

int? rowForLine(int file, int number, {bool oldSide = false}) {
  for (final block in _blocks) {
    if (block.file != file) continue;
    final start = oldSide ? block.oldStart : block.newStart;
    final count = oldSide ? block.oldCount : block.newCount;
    if (start != null && number >= start && number < start + count) {
      return block.start + number - start;
    }
  }
  return null;
}