From b20bdea8f08884e89c2d5cac99910e0b2049610c Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sat, 25 Jul 2020 13:00:23 +0300 Subject: [PATCH] EXECUTE: cancel command with Esc --- src/bin.rs | 2 +- src/components/utilities.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bin.rs b/src/bin.rs index 9fa35b9a..ba94cb8b 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -423,7 +423,7 @@ fn run_app(opt: Opt) -> Result<()> { } UIMode::Execute => { match k { - Key::Char('\n') | Key::Esc => { + Key::Char('\n') => { state.mode = UIMode::Normal; state.rcv_event(UIEvent::ChangeMode(UIMode::Normal)); state.redraw(); diff --git a/src/components/utilities.rs b/src/components/utilities.rs index a005b671..7395d704 100644 --- a/src/components/utilities.rs +++ b/src/components/utilities.rs @@ -1148,6 +1148,13 @@ impl Component for StatusBar { .process_event(&mut UIEvent::InsertInput(k.clone()), context); return true; } + UIEvent::ExInput(Key::Esc) => { + self.ex_buffer.clear(); + context + .replies + .push_back(UIEvent::ChangeMode(UIMode::Normal)); + return true; + } UIEvent::Resize => { self.dirty = true; }