aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-13 04:57:28 +0000
committerBlaž Hrastnik2020-12-13 04:57:28 +0000
commit07801b60bccd0f084eae925e0290c24322de575f (patch)
tree016aa433cf7c226341e9c3c3e74ea65060db1914 /helix-term/src
parent7dc24a25ba148a9cd7c936e02cc03873ed6a467b (diff)
Remove the prompt on ESC.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/prompt.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 071cac90..ce00a129 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -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 helix_core::Position;
use helix_view::Editor;
@@ -161,7 +161,12 @@ impl Component for Prompt {
} => self.insert_char(c),
KeyEvent {
code: KeyCode::Esc, ..
- } => self.should_close = true,
+ } => {
+ return EventResult::Consumed(Some(Box::new(|compositor: &mut Compositor| {
+ // remove the layer
+ compositor.pop();
+ })));
+ }
KeyEvent {
code: KeyCode::Right,
..