Skip to content

Commit

Permalink
fix: mainting descending span end oder during subslice
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Sep 25, 2022
1 parent 447270a commit 276e58b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions helix-core/src/syntax/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,16 @@ impl Iterator for SpanIter {

// Find the index of the largest span smaller than the intersect point.
// `i` starts on the index after the last subsliced span.
loop {
match self.spans.get(i) {
Some(span) if span.start < intersect => {
after = Some(i);
i += 1;
}
_ => break,
let intersect_pos = Span {
start: intersect,
..span
};
while let Some(span) = self.spans.get(i) {
if span <= &intersect_pos {
after = Some(i);
i += 1;
} else {
break;
}
}

Expand Down

0 comments on commit 276e58b

Please sign in to comment.