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 => {
match k {
Key::Char('\n') | Key::Esc => {
Key::Char('\n') => {
state.mode = UIMode::Normal;
state.rcv_event(UIEvent::ChangeMode(UIMode::Normal));
state.redraw();

View File

@ -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;
}