From 4300a3ad058ea383a59a0a90f31a597eb264a7d4 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 2 Mar 2023 19:08:47 +0100 Subject: [PATCH] create savepoint before requesting completion --- helix-term/src/commands.rs | 1 + helix-term/src/ui/editor.rs | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e09a1c5bb..55ca875dc 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4181,6 +4181,7 @@ pub fn completion(cx: &mut Context) { iter.reverse(); let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count(); let start_offset = cursor.saturating_sub(offset); + doc.savepoint(); cx.callback( future, diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 59f371bda..2ea1b7147 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -957,9 +957,6 @@ impl EditorView { return; } - // Immediately initialize a savepoint - doc_mut!(editor).savepoint(); - editor.last_completion = None; self.last_insert.1.push(InsertEvent::TriggerCompletion);