From 3a7bf1c40cba7f4763df38e347587b5c3003d080 Mon Sep 17 00:00:00 2001 From: Andrey Tkachenko Date: Wed, 20 Apr 2022 05:42:33 +0400 Subject: Restore document state on completion cancel (#2096) --- helix-term/src/ui/completion.rs | 1 + helix-term/src/ui/popup.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'helix-term/src/ui') diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 556273bc..38005aad 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -135,6 +135,7 @@ impl Completion { match event { PromptEvent::Abort => { + doc.restore(view.id); editor.last_completion = None; } PromptEvent::Update => { diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index 45527482..069a22f4 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -124,7 +124,10 @@ impl Component for Popup { match key.into() { // esc or ctrl-c aborts the completion and closes the menu - key!(Esc) | ctrl!('c') => EventResult::Consumed(Some(close_fn)), + key!(Esc) | ctrl!('c') => { + let _ = self.contents.handle_event(event, cx); + EventResult::Consumed(Some(close_fn)) + } ctrl!('d') => { self.scroll(self.size.1 as usize / 2, true); EventResult::Consumed(None) -- cgit v1.2.3-70-g09d2