EXECUTE: cancel command with Esc

memfd
Manos Pitsidianakis 2020-07-25 13:00:23 +03:00
parent 989cfcc877
commit b20bdea8f0
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
2 changed files with 8 additions and 1 deletions

View File

@ -423,7 +423,7 @@ fn run_app(opt: Opt) -> Result<()> {
} }
UIMode::Execute => { UIMode::Execute => {
match k { match k {
Key::Char('\n') | Key::Esc => { Key::Char('\n') => {
state.mode = UIMode::Normal; state.mode = UIMode::Normal;
state.rcv_event(UIEvent::ChangeMode(UIMode::Normal)); state.rcv_event(UIEvent::ChangeMode(UIMode::Normal));
state.redraw(); state.redraw();

View File

@ -1148,6 +1148,13 @@ impl Component for StatusBar {
.process_event(&mut UIEvent::InsertInput(k.clone()), context); .process_event(&mut UIEvent::InsertInput(k.clone()), context);
return true; return true;
} }
UIEvent::ExInput(Key::Esc) => {
self.ex_buffer.clear();
context
.replies
.push_back(UIEvent::ChangeMode(UIMode::Normal));
return true;
}
UIEvent::Resize => { UIEvent::Resize => {
self.dirty = true; self.dirty = true;
} }