parseLineRanges function
Parses a comma-separated list of line ranges (e.g. 5-16,960-973).
Returns the ranges in ascending order with overlapping/adjacent ranges
merged so downstream consumers can stream the file in a single forward
pass per range. Returns null when any chunk is not range-shaped.
Implementation
List<LineRange>? parseLineRanges(String sel) {
final parsed = _parseRangeChunks(sel);
if (parsed == null) return null;
parsed.sort((a, b) => a.startLine.compareTo(b.startLine));
return _mergeRanges(parsed);
}