Remove the prompt on ESC.

This commit is contained in:
Blaž Hrastnik 2020-12-13 13:57:28 +09:00
parent 7dc24a25ba
commit 07801b60bc

View File

@ -1,4 +1,4 @@
use crate::compositor::{Component, Context, EventResult}; use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use helix_core::Position; use helix_core::Position;
use helix_view::Editor; use helix_view::Editor;
@ -161,7 +161,12 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
} => self.insert_char(c), } => self.insert_char(c),
KeyEvent { KeyEvent {
code: KeyCode::Esc, .. code: KeyCode::Esc, ..
} => self.should_close = true, } => {
return EventResult::Consumed(Some(Box::new(|compositor: &mut Compositor| {
// remove the layer
compositor.pop();
})));
}
KeyEvent { KeyEvent {
code: KeyCode::Right, code: KeyCode::Right,
.. ..