fix: tree sitter rendering glitches with multiple selection edits
commit7c834d6506afca0d010bb34cfab410f754877b1e
authorBlaž Hrastnik <blaz@mxxn.io>
dateFri 13 Aug 2021, 13:15 (5 years ago)
parent9a39a10
helix-core/src/syntax.rs+4−2
@@ -656,8 +656,10 @@ impl LanguageLayer {
656656 let edits = Self::generate_edits(old_source.slice(..), changeset);
657657
658658 // Notify the tree about all the changes
659− for edit in edits {
660− self.tree.as_mut().unwrap().edit(&edit);
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
662+ self.tree.as_mut().unwrap().edit(edit);
661663 }
662664
663665 self.parse(