From 9508684031a03663301d00d15149200c1b89db9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sat, 8 Jan 2022 17:35:32 +0900 Subject: [PATCH] fix: Skip modifying the root layer range, it always covers 0..max --- helix-core/src/syntax.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 75f8536b2..d064aadf2 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;