In the adjacent-location merge branch, a.location_end is overwritten with b.location_end. Since parse_clippings allows location_end to be None when the input is Location <n> (no range), this can accidentally erase an existing a.location_end even though the merged clipping still has a known end. Consider normalizing single-location entries to end = start in parse_clippings, or (at least in this branch) updating the end via max_opt(a.location_end, b.location_end.or(b.location_start)) / preserving a.location_end when b.location_end is None.
let new_end = max_opt(a.location_end, b.location_end.or(b.location_start));
a.location_end = new_end;
Originally posted by @Copilot in #14 (comment)
In the adjacent-location merge branch,
a.location_endis overwritten withb.location_end. Sinceparse_clippingsallowslocation_endto beNonewhen the input isLocation <n>(no range), this can accidentally erase an existinga.location_endeven though the merged clipping still has a known end. Consider normalizing single-location entries toend = startinparse_clippings, or (at least in this branch) updating the end viamax_opt(a.location_end, b.location_end.or(b.location_start))/ preservinga.location_endwhenb.location_endisNone.Originally posted by @Copilot in #14 (comment)