From cf7b19d7115b7c5a9c5516713478908d157bda61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 6 Apr 2021 17:29:39 +0900 Subject: [PATCH] Always update selection: Empty transactions can still change selections. --- helix-view/src/document.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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