on master help sign in
fix: tree sitter rendering glitches with multiple selection edits
7c834d6Blaž Hrastnik
helix-core/src/syntax.rs+4−2
@@ -656,8 +656,10 @@ impl LanguageLayer {
656 let edits = Self::generate_edits(old_source.slice(..), changeset);
656 let edits = Self::generate_edits(old_source.slice(..), changeset);
657
657
658 // Notify the tree about all the changes
658 // Notify the tree about all the changes
659− for edit in edits {
659+ for edit in edits.iter().rev() {
660+ // apply the edits in reverse. If we applied them in order then edit 1 would disrupt
661+ // the positioning of edit 2
660− self.tree.as_mut().unwrap().edit(&edit);
662+ self.tree.as_mut().unwrap().edit(edit);
661 }
663 }
662
664
663 self.parse(
665 self.parse(