From 91557c2c4366b481e80943e94f661c8b47150571 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 16 May 2023 19:48:48 +0300 Subject: [PATCH] mail/listing.rs: prevent list blank when refreshing account Mail list would go blank if the currently focused account received a Status update event. --- melib/src/conf.rs | 6 +++--- src/components/mail.rs | 4 ++-- src/components/mail/listing.rs | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/melib/src/conf.rs b/melib/src/conf.rs index 5a006a97..df5d337a 100644 --- a/melib/src/conf.rs +++ b/melib/src/conf.rs @@ -147,15 +147,15 @@ impl MailboxConf { } } -pub fn true_val() -> bool { +pub const fn true_val() -> bool { true } -pub fn false_val() -> bool { +pub const fn false_val() -> bool { false } -pub fn none() -> Option { +pub const fn none() -> Option { None } diff --git a/src/components/mail.rs b/src/components/mail.rs index 799a7251..5395a63b 100644 --- a/src/components/mail.rs +++ b/src/components/mail.rs @@ -19,8 +19,8 @@ * along with meli. If not, see . */ -/*! Entities that handle Mail specific functions. - */ +//! Entities that handle Mail specific functions. + use melib::{ backends::{AccountHash, Mailbox, MailboxHash}, email::{attachment_types::*, attachments::*}, diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs index 785dd5c4..5d6e0982 100644 --- a/src/components/mail/listing.rs +++ b/src/components/mail/listing.rs @@ -1037,7 +1037,6 @@ impl Component for Listing { }, }) .collect::<_>(); - self.set_dirty(true); self.menu_content.empty(); context .replies @@ -1945,6 +1944,7 @@ impl Component for Listing { } false } + fn is_dirty(&self) -> bool { self.dirty || self @@ -1953,6 +1953,7 @@ impl Component for Listing { .map(Component::is_dirty) .unwrap_or_else(|| self.component.is_dirty()) } + fn set_dirty(&mut self, value: bool) { self.dirty = value; if let Some(s) = self.status.as_mut() { @@ -2577,6 +2578,7 @@ impl Listing { .process_event(&mut UIEvent::VisibilityChange(false), context); self.component .set_coordinates((account_hash, *mailbox_hash)); + self.component.refresh_mailbox(context, true); /* Check if per-mailbox configuration overrides general configuration */ let index_style =