fix: tree sitter rendering glitches with multiple selection edits

pull/578/head
Blaž Hrastnik 2021-08-13 13:15:10 +09:00
parent 9a39a10ddd
commit 7c834d6506
1 changed files with 4 additions and 2 deletions

View File

@ -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(