aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-01-08 08:35:32 +0000
committerBlaž Hrastnik2022-01-23 07:04:12 +0000
commit9508684031a03663301d00d15149200c1b89db9a (patch)
treeede08abab2ee2e019530efc3afa0ae38489767a5 /helix-core
parent7315f6f3e419d8f433a5cc99d929289ce710f442 (diff)
fix: Skip modifying the root layer range, it always covers 0..max
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/syntax.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 75f8536b..d064aadf 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -494,7 +494,13 @@ impl Syntax {
}
for layer in &mut self.layers.values_mut() {
+ // The root layer always covers the whole range (0..usize::MAX)
+ if layer.depth == 0 {
+ continue;
+ }
+
for range in &mut layer.ranges {
+ // Roughly based on https://github.com/tree-sitter/tree-sitter/blob/ddeaa0c7f534268b35b4f6cb39b52df082754413/lib/src/subtree.c#L691-L720
for edit in edits.iter().rev() {
let is_pure_insertion = edit.old_end_byte == edit.start_byte;