ui: Consume Esc input events only when necessary

async
Manos Pitsidianakis 2020-02-09 23:32:14 +02:00
parent 9757e523bd
commit 4090eecd04
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
4 changed files with 6 additions and 4 deletions

View File

@ -726,7 +726,9 @@ impl Component for ContactList {
self.menu_visibility = !self.menu_visibility; self.menu_visibility = !self.menu_visibility;
self.set_dirty(true); self.set_dirty(true);
} }
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) => { UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt(''))
if !self.cmd_buf.is_empty() =>
{
self.cmd_buf.clear(); self.cmd_buf.clear();
context context
.replies .replies

View File

@ -816,7 +816,7 @@ impl Component for Listing {
self.get_status(context), self.get_status(context),
))); )));
} }
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) => { UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) if !self.cmd_buf.is_empty() => {
self.cmd_buf.clear(); self.cmd_buf.clear();
context context
.replies .replies

View File

@ -839,7 +839,7 @@ impl Component for MailView {
self.set_dirty(true); self.set_dirty(true);
return true; return true;
} }
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) => { UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) if !self.cmd_buf.is_empty() => {
self.cmd_buf.clear(); self.cmd_buf.clear();
context context
.replies .replies

View File

@ -373,7 +373,7 @@ impl Component for EnvelopeView {
} }
} }
match *event { match *event {
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) => { UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) if !self.cmd_buf.is_empty() => {
self.cmd_buf.clear(); self.cmd_buf.clear();
context context
.replies .replies