aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-06 08:29:39 +0000
committerBlaž Hrastnik2021-04-06 08:29:39 +0000
commitcf7b19d7115b7c5a9c5516713478908d157bda61 (patch)
tree07eb11699ed379c2b1014e795ca54d44e0874cdd /helix-view
parent015fd2ffa2993c77c023c890a13f90f0a908b151 (diff)
Always update selection: Empty transactions can still change selections.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/document.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index d63e8591..8e836f03 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -192,7 +192,7 @@ impl Document {
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
// current selection through changes.
let selection = transaction
@@ -200,7 +200,9 @@ impl Document {
.cloned()
.unwrap_or_else(|| self.selection(view_id).clone().map(transaction.changes()));
self.set_selection(view_id, selection);
+ }
+ if !transaction.changes().is_empty() {
self.version += 1;
// update tree-sitter syntax tree