mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 05:27:07 +04:00
Restore document state on completion cancel (#2096)
This commit is contained in:
parent
cc68fa857d
commit
3a7bf1c40c
@ -135,6 +135,7 @@ fn completion_changes(transaction: &Transaction, trigger_offset: usize) -> Vec<C
|
||||
|
||||
match event {
|
||||
PromptEvent::Abort => {
|
||||
doc.restore(view.id);
|
||||
editor.last_completion = None;
|
||||
}
|
||||
PromptEvent::Update => {
|
||||
|
@ -124,7 +124,10 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user