Always update selection: Empty transactions can still change selections.
This commit is contained in:
parent
015fd2ffa2
commit
cf7b19d711
@ -192,7 +192,7 @@ fn _apply(&mut self, transaction: &Transaction, view_id: ViewId) -> bool {
|
|||||||
|
|
||||||
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 @@ fn _apply(&mut self, transaction: &Transaction, view_id: ViewId) -> bool {
|
|||||||
.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…
Reference in New Issue
Block a user