ui: exit contact add dialog with Esc in mail view

jmap
Manos Pitsidianakis 2019-11-10 13:33:56 +02:00
parent 06d99c7f92
commit 0cbc44fd0e
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 8 additions and 2 deletions

View File

@ -209,7 +209,7 @@ impl MailView {
)) ))
.into_owned(); .into_owned();
match self.mode { match self.mode {
ViewMode::Normal | ViewMode::Subview => { ViewMode::Normal | ViewMode::Subview | ViewMode::ContactSelector(_) => {
let mut t = body_text.to_string(); let mut t = body_text.to_string();
t.push('\n'); t.push('\n');
if body.count_attachments() > 1 { if body.count_attachments() > 1 {
@ -257,7 +257,6 @@ impl MailView {
ret.push_str(&attachments[aidx].text()); ret.push_str(&attachments[aidx].text());
ret ret
} }
ViewMode::ContactSelector(_) => unimplemented!(),
} }
} }
pub fn plain_text_to_buf(s: &str, highlight_urls: bool) -> CellBuffer { pub fn plain_text_to_buf(s: &str, highlight_urls: bool) -> CellBuffer {
@ -724,6 +723,13 @@ impl Component for MailView {
self.dirty = true; self.dirty = true;
return true; return true;
} }
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt(''))
if self.mode.is_contact_selector() =>
{
self.mode = ViewMode::Normal;
self.set_dirty();
return true;
}
UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) => { UIEvent::Input(Key::Esc) | UIEvent::Input(Key::Alt('')) => {
self.cmd_buf.clear(); self.cmd_buf.clear();
context context