on master help sign in
Always update selection: Empty transactions can still change selections.
cf7b19dBlaž Hrastnik
helix-view/src/document.rs+3−1
@@ -192,7 +192,7 @@ impl Document {
192
192
193 let success = transaction.changes().apply(&mut self.text);
193 let success = transaction.changes().apply(&mut self.text);
194
194
195− if !transaction.changes().is_empty() {
195+ if success {
196 // update the selection: either take the selection specified in the transaction, or map the
196 // update the selection: either take the selection specified in the transaction, or map the
197 // current selection through changes.
197 // current selection through changes.
198 let selection = transaction
198 let selection = transaction
@@ -200,7 +200,9 @@ impl Document {
200 .cloned()
200 .cloned()
201 .unwrap_or_else(|| self.selection(view_id).clone().map(transaction.changes()));
201 .unwrap_or_else(|| self.selection(view_id).clone().map(transaction.changes()));
202 self.set_selection(view_id, selection);
202 self.set_selection(view_id, selection);
203+ }
203
204
205+ if !transaction.changes().is_empty() {
204 self.version += 1;
206 self.version += 1;
205
207
206 // update tree-sitter syntax tree
208 // update tree-sitter syntax tree