fix crash when encountering overlapping injections
This commit is contained in:
parent
79a8fd6249
commit
2d5ff9ec8f
|
@ -1136,6 +1136,7 @@ fn point_sub(a: Point, b: Point) -> Point {
|
||||||
RopeProvider(source_slice),
|
RopeProvider(source_slice),
|
||||||
);
|
);
|
||||||
let mut injections = Vec::new();
|
let mut injections = Vec::new();
|
||||||
|
let mut last_injection_end = 0;
|
||||||
for mat in matches {
|
for mat in matches {
|
||||||
let (injection_capture, content_node, included_children) = layer
|
let (injection_capture, content_node, included_children) = layer
|
||||||
.config
|
.config
|
||||||
|
@ -1155,6 +1156,10 @@ fn point_sub(a: Point, b: Point) -> Point {
|
||||||
intersect_ranges(&layer.ranges, &[content_node], included_children);
|
intersect_ranges(&layer.ranges, &[content_node], included_children);
|
||||||
|
|
||||||
if !ranges.is_empty() {
|
if !ranges.is_empty() {
|
||||||
|
if content_node.start_byte() < last_injection_end {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
last_injection_end = content_node.end_byte();
|
||||||
injections.push((config, ranges));
|
injections.push((config, ranges));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue