diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-02-09 23:32:14 +0200 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-02-09 23:32:14 +0200 |
commit | 4090eecd0416a206ad7d6b919042595c60f8164c (patch) | |
tree | c4afe5ce818b97fcd6794c8ffd5cd9c82f9866df /src/components | |
parent | 9757e523bd891dc67cf33bd93fb28fed2669fa17 (diff) |
ui: Consume Esc input events only when necessary
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/contacts/contact_list.rs | 4 | ||||
-rw-r--r-- | src/components/mail/listing.rs | 2 | ||||
-rw-r--r-- | src/components/mail/view.rs | 2 | ||||
-rw-r--r-- | src/components/mail/view/envelope.rs | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/src/components/contacts/contact_list.rs b/src/components/contacts/contact_list.rs index fc99334a..5bec1f0d 100644 --- a/src/components/contacts/contact_list.rs +++ b/src/components/contacts/contact_list.rs @@ -726,7 +726,9 @@ impl Component for ContactList { self.menu_visibility = !self.menu_visibility; 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(); context .replies diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs index 1b3410ee..c2bc68c5 100644 --- a/src/components/mail/listing.rs +++ b/src/components/mail/listing.rs @@ -816,7 +816,7 @@ impl Component for Listing { 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(); context .replies diff --git a/src/components/mail/view.rs b/src/components/mail/view.rs index 82207c34..6948d3de 100644 --- a/src/components/mail/view.rs +++ b/src/components/mail/view.rs @@ -839,7 +839,7 @@ impl Component for MailView { self.set_dirty(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(); context .replies diff --git a/src/components/mail/view/envelope.rs b/src/components/mail/view/envelope.rs index 187f37d2..2e8531b5 100644 --- a/src/components/mail/view/envelope.rs +++ b/src/components/mail/view/envelope.rs @@ -373,7 +373,7 @@ impl Component for EnvelopeView { } } 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(); context .replies |