From 85e6ea10913281efce5d90e81d5db2d9a4e5ff99 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 3 Feb 2022 12:10:22 +0100 Subject: [PATCH] Transact on applying completion to allow restoring of selections on undo --- crates/editor/src/editor.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index f45580b6c1585eaedb210638ca768f5d0f6746ec..d3b365329fe3d56c0288005a317a7a2c25ac3870 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1687,6 +1687,7 @@ impl Editor { .get(completion_ix.unwrap_or(completion_state.selected_item))?; let completion = completion_state.completions.get(mat.candidate_id)?; + self.start_transaction(cx); if completion.is_snippet() { self.insert_snippet(completion.old_range.clone(), &completion.new_text, cx) .log_err(); @@ -1702,6 +1703,7 @@ impl Editor { } }); } + self.end_transaction(cx); Some(self.buffer.update(cx, |buffer, cx| { buffer.apply_additional_edits_for_completion(completion.clone(), cx)