summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-28 05:50:35 +0000
committerBlaž Hrastnik2021-06-28 05:50:35 +0000
commitd4e1ec339e022ffd5073873ac0bc64e3c095d064 (patch)
tree7d961495aad900a6a5efed193b3c3bd19069842f
parentd94410a6782a2ac52dde2708fcadf9cbddfd8f93 (diff)
Don't crash if diagnostics span past EOF
-rw-r--r--helix-core/src/syntax.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index d03ca6bf..c556a347 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -1765,6 +1765,11 @@ impl<I: Iterator<Item = HighlightEvent>> Iterator for Merge<I> {
self.next_event = self.iter.next();
Some(event)
}
+ // can happen if deleting and cursor at EOF, and diagnostic reaches past the end
+ (None, Some((span, range))) => {
+ self.next_span = None;
+ None
+ }
(None, None) => None,
e => unreachable!("{:?}", e),
}