fix: Skip modifying the root layer range, it always covers 0..max
commit9508684031a03663301d00d15149200c1b89db9a
authorBlaž Hrastnik <blaz@mxxn.io>
dateSat 8 Jan 2022, 17:35 (5 years ago)
parent7315f6f
helix-core/src/syntax.rs+6
@@ -494,7 +494,13 @@ impl Syntax {
494494 }
495495
496496 for layer in &mut self.layers.values_mut() {
497+ // The root layer always covers the whole range (0..usize::MAX)
498+ if layer.depth == 0 {
499+ continue;
500+ }
501+
497502 for range in &mut layer.ranges {
503+ // Roughly based on https://github.com/tree-sitter/tree-sitter/blob/ddeaa0c7f534268b35b4f6cb39b52df082754413/lib/src/subtree.c#L691-L720
498504 for edit in edits.iter().rev() {
499505 let is_pure_insertion = edit.old_end_byte == edit.start_byte;
500506