on master help sign in
Remove the prompt on ESC.
commit07801b60bccd0f084eae925e0290c24322de575f authorBlaž Hrastnik <blaz@mxxn.io> dateSun 13 Dec 2020, 13:57 (6 years ago) parent7dc24a2
1 file changed+7−2
helix-term/src/ui/prompt.rs+7−2
helix-term/src/ui/prompt.rs+7−2
@@ -1,4 +1,4 @@
1−use crate::compositor::{Component, Context, EventResult};
1+use crate::compositor::{Component, Compositor, Context, EventResult};
22use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
33use helix_core::Position;
44use helix_view::Editor;
@@ -161,7 +161,12 @@ impl Component for Prompt {
161161 } => self.insert_char(c),
162162 KeyEvent {
163163 code: KeyCode::Esc, ..
164− } => self.should_close = true,
164+ } => {
165+ return EventResult::Consumed(Some(Box::new(|compositor: &mut Compositor| {
166+ // remove the layer
167+ compositor.pop();
168+ })));
169+ }
165170 KeyEvent {
166171 code: KeyCode::Right,
167172 ..