From f972f69bad54f29671a473d4f9a96e39fd7e4448 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 12 May 2019 15:10:39 +0300 Subject: [PATCH] ui: send RefreshMailbox events in every refresh_mailbox call closes #108 --- ui/src/components/mail/listing/compact.rs | 6 +++--- ui/src/components/utilities.rs | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs index fb420a76..f7688ccb 100644 --- a/ui/src/components/mail/listing/compact.rs +++ b/ui/src/components/mail/listing/compact.rs @@ -155,6 +155,9 @@ impl MailboxView { self.cursor_pos.1 = self.new_cursor_pos.1; self.cursor_pos.0 = self.new_cursor_pos.0; let folder_hash = context.accounts[self.cursor_pos.0].folders_order[self.cursor_pos.1]; + context + .replies + .push_back(UIEvent::RefreshMailbox((self.cursor_pos.0, folder_hash))); // Get mailbox as a reference. // @@ -582,9 +585,6 @@ impl Component for MailboxView { self.dirty = true; return true; } - UIEvent::RefreshMailbox(_) => { - self.dirty = true; - } UIEvent::MailboxUpdate((ref idxa, ref idxf)) if (*idxa, *idxf) == ( diff --git a/ui/src/components/utilities.rs b/ui/src/components/utilities.rs index 0521dca1..37f58a03 100644 --- a/ui/src/components/utilities.rs +++ b/ui/src/components/utilities.rs @@ -592,16 +592,24 @@ impl StatusBar { } fn draw_status_bar(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) { clear_area(grid, area); + let (x, y) = write_string_to_grid( + &self.status, + grid, + Color::Byte(123), + Color::Byte(26), + area, + false, + ); if let Some(n) = self.notifications.pop_front() { - self.dirty = true; - write_string_to_grid(&n, grid, Color::Byte(219), Color::Byte(88), area, false); - } else { write_string_to_grid( - &self.status, + &n, grid, - Color::Byte(123), - Color::Byte(26), - area, + Color::Byte(219), + Color::Byte(88), + ( + (std::cmp::max(x, width!(area).saturating_sub(n.len())), y), + bottom_right!(area), + ), false, ); }