Always update selection: Empty transactions can still change selections.

imgbot
Blaž Hrastnik 4 years ago
parent 015fd2ffa2
commit cf7b19d711

@ -192,7 +192,7 @@ impl Document {
let success = transaction.changes().apply(&mut self.text); let success = transaction.changes().apply(&mut self.text);
if !transaction.changes().is_empty() { if success {
// update the selection: either take the selection specified in the transaction, or map the // update the selection: either take the selection specified in the transaction, or map the
// current selection through changes. // current selection through changes.
let selection = transaction let selection = transaction
@ -200,7 +200,9 @@ impl Document {
.cloned() .cloned()
.unwrap_or_else(|| self.selection(view_id).clone().map(transaction.changes())); .unwrap_or_else(|| self.selection(view_id).clone().map(transaction.changes()));
self.set_selection(view_id, selection); self.set_selection(view_id, selection);
}
if !transaction.changes().is_empty() {
self.version += 1; self.version += 1;
// update tree-sitter syntax tree // update tree-sitter syntax tree

Loading…
Cancel
Save