From 7c834d6506afca0d010bb34cfab410f754877b1e Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 13 Aug 2021 13:15:10 +0900 Subject: fix: tree sitter rendering glitches with multiple selection edits --- helix-core/src/syntax.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'helix-core/src') diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 60d44976..4bceb73b 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -656,8 +656,10 @@ impl LanguageLayer { let edits = Self::generate_edits(old_source.slice(..), changeset); // Notify the tree about all the changes - for edit in edits { - self.tree.as_mut().unwrap().edit(&edit); + for edit in edits.iter().rev() { + // apply the edits in reverse. If we applied them in order then edit 1 would disrupt + // the positioning of edit 2 + self.tree.as_mut().unwrap().edit(edit); } self.parse( -- cgit v1.2.3-70-g09d2