aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorPascal Kuthe2023-07-13 21:36:47 +0000
committerBlaž Hrastnik2023-07-17 05:08:50 +0000
commit2d5ff9ec8ff3d054973cc9198312e577863e693f (patch)
tree02ace80af1017af38add5949cdb427d17b992ba5 /helix-core
parent79a8fd6249970f9eebde46569681ec6e47349b00 (diff)
fix crash when encountering overlapping injections
Diffstat (limited to 'helix-core')
-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 f43b03ad..55062152 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -1136,6 +1136,7 @@ impl Syntax {
RopeProvider(source_slice),
);
let mut injections = Vec::new();
+ let mut last_injection_end = 0;
for mat in matches {
let (injection_capture, content_node, included_children) = layer
.config
@@ -1155,6 +1156,10 @@ impl Syntax {
intersect_ranges(&layer.ranges, &[content_node], included_children);
if !ranges.is_empty() {
+ if content_node.start_byte() < last_injection_end {
+ continue;
+ }
+ last_injection_end = content_node.end_byte();
injections.push((config, ranges));
}
}