fix(read_span): fix off-by-one issue

This commit is contained in:
Kat Marchán 2021-09-22 13:14:13 -07:00
parent 77c5899bbd
commit eea5c29935
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ fn context_info<'a>(
start_line += 1;
before_lines_starts.remove(0);
}
} else if offset >= span.offset() + span.len() - 1 {
} else if offset >= span.offset() + span.len().saturating_sub(1) {
// We're after the end of the span, but haven't necessarily
// started collecting end lines yet (we might still be
// collecting context lines).