Skip to content

Commit

Permalink
Restore document state on completion cancel (#2096)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreytkachenko authored Apr 20, 2022
1 parent cc68fa8 commit 3a7bf1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions helix-term/src/ui/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl Completion {

match event {
PromptEvent::Abort => {
doc.restore(view.id);
editor.last_completion = None;
}
PromptEvent::Update => {
Expand Down
5 changes: 4 additions & 1 deletion helix-term/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ impl<T: Component> Component for Popup<T> {

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)
Expand Down

0 comments on commit 3a7bf1c

Please sign in to comment.