on master help sign in
fix crash when encountering overlapping injections
commit2d5ff9ec8ff3d054973cc9198312e577863e693f authorPascal Kuthe <pascal.kuthe@semimod.de> dateThu 13 Jul 2023, 23:36 (3 years ago) parent79a8fd6
1 file changed+5
helix-core/src/syntax.rs+5
helix-core/src/syntax.rs+5
@@ -1136,6 +1136,7 @@ impl Syntax {
11361136 RopeProvider(source_slice),
11371137 );
11381138 let mut injections = Vec::new();
1139+ let mut last_injection_end = 0;
11391140 for mat in matches {
11401141 let (injection_capture, content_node, included_children) = layer
11411142 .config
@@ -1155,6 +1156,10 @@ impl Syntax {
11551156 intersect_ranges(&layer.ranges, &[content_node], included_children);
11561157
11571158 if !ranges.is_empty() {
1159+ if content_node.start_byte() < last_injection_end {
1160+ continue;
1161+ }
1162+ last_injection_end = content_node.end_byte();
11581163 injections.push((config, ranges));
11591164 }
11601165 }