on master help sign in
Restore document state on completion cancel (#2096)
commit3a7bf1c40cba7f4763df38e347587b5c3003d080 authorAndrey Tkachenko <andrey@aidev.ru> dateWed 20 Apr 2022, 05:42 (5 years ago) parentcc68fa8
2 files changed+5−1
helix-term/src/ui/completion.rs+1 helix-term/src/ui/popup.rs+4−1
helix-term/src/ui/completion.rs+1
@@ -135,6 +135,7 @@ impl Completion {
135135
136136 match event {
137137 PromptEvent::Abort => {
138+ doc.restore(view.id);
138139 editor.last_completion = None;
139140 }
140141 PromptEvent::Update => {
helix-term/src/ui/popup.rs+4−1
@@ -124,7 +124,10 @@ impl<T: Component> Component for Popup<T> {
124124
125125 match key.into() {
126126 // esc or ctrl-c aborts the completion and closes the menu
127− key!(Esc) | ctrl!('c') => EventResult::Consumed(Some(close_fn)),
127+ key!(Esc) | ctrl!('c') => {
128+ let _ = self.contents.handle_event(event, cx);
129+ EventResult::Consumed(Some(close_fn))
130+ }
128131 ctrl!('d') => {
129132 self.scroll(self.size.1 as usize / 2, true);
130133 EventResult::Consumed(None)