on master help sign in
Don't crash if diagnostics span past EOF
commitd4e1ec339e022ffd5073873ac0bc64e3c095d064 authorBlaž Hrastnik <blaz@mxxn.io> dateMon 28 Jun 2021, 14:50 (5 years ago) parentd94410a
1 file changed+5
helix-core/src/syntax.rs+5
helix-core/src/syntax.rs+5
@@ -1765,6 +1765,11 @@ impl<I: Iterator<Item = HighlightEvent>> Iterator for Merge<I> {
17651765 self.next_event = self.iter.next();
17661766 Some(event)
17671767 }
1768+ // can happen if deleting and cursor at EOF, and diagnostic reaches past the end
1769+ (None, Some((span, range))) => {
1770+ self.next_span = None;
1771+ None
1772+ }
17681773 (None, None) => None,
17691774 e => unreachable!("{:?}", e),
17701775 }