on master help sign in
Restore document state on completion cancel (#2096)
3a7bf1cAndrey Tkachenko
helix-term/src/ui/completion.rs+1
@@ -135,6 +135,7 @@ impl Completion {
135
135
136 match event {
136 match event {
137 PromptEvent::Abort => {
137 PromptEvent::Abort => {
138+ doc.restore(view.id);
138 editor.last_completion = None;
139 editor.last_completion = None;
139 }
140 }
140 PromptEvent::Update => {
141 PromptEvent::Update => {
helix-term/src/ui/popup.rs+4−1
@@ -124,7 +124,10 @@ impl<T: Component> Component for Popup<T> {
124
124
125 match key.into() {
125 match key.into() {
126 // esc or ctrl-c aborts the completion and closes the menu
126 // esc or ctrl-c aborts the completion and closes the menu
127+ key!(Esc) | ctrl!('c') => {
128+ let _ = self.contents.handle_event(event, cx);
127− key!(Esc) | ctrl!('c') => EventResult::Consumed(Some(close_fn)),
129+ EventResult::Consumed(Some(close_fn))
130+ }
128 ctrl!('d') => {
131 ctrl!('d') => {
129 self.scroll(self.size.1 as usize / 2, true);
132 self.scroll(self.size.1 as usize / 2, true);
130 EventResult::Consumed(None)
133 EventResult::Consumed(None)