mail/listing: check row_updates in is_dirty()
Run cargo lints / Lint on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 9m0s Details
Cargo manifest lints / Lint Cargo manifests on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 14m3s Details
Run Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 12m10s Details

If there are row_updates, it means we need to redraw. But in the draw()
call, we check is_dirty() to decide whether to proceed drawing. Add
row_updates not being empty into the dirty conditions.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/331/head
Manos Pitsidianakis 2023-12-21 20:13:11 +02:00
parent 933bf157ae
commit 0da97dd8c1
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
4 changed files with 26 additions and 12 deletions

View File

@ -2118,11 +2118,12 @@ impl Component for CompactListing {
} }
fn is_dirty(&self) -> bool { fn is_dirty(&self) -> bool {
self.force_draw match self.focus {
|| match self.focus { Focus::None | Focus::Entry => {
Focus::None | Focus::Entry => self.dirty, self.dirty || self.force_draw || !self.rows.row_updates.is_empty()
Focus::EntryFullscreen => false,
} }
Focus::EntryFullscreen => false,
}
} }
fn set_dirty(&mut self, value: bool) { fn set_dirty(&mut self, value: bool) {

View File

@ -1229,11 +1229,21 @@ impl Component for ConversationsListing {
} }
if self.force_draw { if self.force_draw {
// Draw the entire list // Draw the entire list
let area = if matches!(self.focus, Focus::Entry) {
area.take_cols(area.width() / 3)
} else {
area
};
self.draw_list(grid, area, context); self.draw_list(grid, area, context);
self.force_draw = false; self.force_draw = false;
} }
} else { } else {
// Draw the entire list // Draw the entire list
let area = if matches!(self.focus, Focus::Entry) {
area.take_cols(area.width() / 3)
} else {
area
};
self.draw_list(grid, area, context); self.draw_list(grid, area, context);
} }
} }
@ -1510,8 +1520,9 @@ impl Component for ConversationsListing {
fn is_dirty(&self) -> bool { fn is_dirty(&self) -> bool {
match self.focus { match self.focus {
Focus::None => self.dirty, Focus::None | Focus::Entry => {
Focus::Entry => self.dirty, self.dirty || self.force_draw || !self.rows.row_updates.is_empty()
}
Focus::EntryFullscreen => false, Focus::EntryFullscreen => false,
} }
} }

View File

@ -1835,11 +1835,12 @@ impl Component for PlainListing {
} }
fn is_dirty(&self) -> bool { fn is_dirty(&self) -> bool {
self.force_draw match self.focus {
|| match self.focus { Focus::None | Focus::Entry => {
Focus::None | Focus::Entry => self.dirty, self.dirty || self.force_draw || !self.rows.row_updates.is_empty()
Focus::EntryFullscreen => false,
} }
Focus::EntryFullscreen => false,
}
} }
fn set_dirty(&mut self, value: bool) { fn set_dirty(&mut self, value: bool) {

View File

@ -1682,8 +1682,9 @@ impl Component for ThreadListing {
fn is_dirty(&self) -> bool { fn is_dirty(&self) -> bool {
match self.focus { match self.focus {
Focus::None => self.dirty, Focus::None | Focus::Entry => {
Focus::Entry => self.dirty, self.dirty || self.force_draw || !self.rows.row_updates.is_empty()
}
Focus::EntryFullscreen => false, Focus::EntryFullscreen => false,
} }
} }