From b823969ae244523a675e9488ecda3a0ca6c630fc Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 27 Jan 2020 17:15:29 +0200 Subject: [PATCH] small fixes - Don't debug print Timer events in src/bin.rs event loop; they're too frequent and pollute the logs - chain set_{fg,bg,..} method calls for &mut Cell - remove unneeded u8 to u8 cast --- src/bin.rs | 2 +- .../components/mail/listing/conversations.rs | 33 +++++++++++-------- ui/src/terminal/cells.rs | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/bin.rs b/src/bin.rs index ef3b74005..d6c6eaf14 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -290,7 +290,7 @@ fn run_app() -> Result<()> { crossbeam::select! { recv(receiver) -> r => { match r { - Ok(ThreadEvent::Pulse) => {}, + Ok(ThreadEvent::Pulse) | Ok(ThreadEvent::UIEvent(UIEvent::Timer(_))) => {}, _ => {debug!(&r);} } match r.unwrap() { diff --git a/ui/src/components/mail/listing/conversations.rs b/ui/src/components/mail/listing/conversations.rs index 9cf1bd243..6bca1d111 100644 --- a/ui/src/components/mail/listing/conversations.rs +++ b/ui/src/components/mail/listing/conversations.rs @@ -748,19 +748,21 @@ impl ConversationsListing { ); self.content[(x, 3 * idx)].set_bg(color); if _x < width { - self.content[(_x, 3 * idx)].set_bg(color); - self.content[(_x, 3 * idx)].set_keep_bg(true); + self.content[(_x, 3 * idx)].set_bg(color).set_keep_bg(true); } for x in (x + 1).._x { - self.content[(x, 3 * idx)].set_keep_fg(true); - self.content[(x, 3 * idx)].set_keep_bg(true); + self.content[(x, 3 * idx)] + .set_keep_fg(true) + .set_keep_bg(true); } self.content[(x, 3 * idx)].set_keep_bg(true); x = _x + 1; } for x in x..width { - self.content[(x, 3 * idx)].set_ch(' '); - self.content[(x, 3 * idx)].set_bg(bg_color); + self.content[(x, 3 * idx)] + .set_ch(' ') + .set_fg(fg_color) + .set_bg(bg_color); } /* Next line, draw date */ let (x, _) = write_string_to_grid( @@ -773,8 +775,10 @@ impl ConversationsListing { None, ); for x in x..(x + 4) { - self.content[(x, 3 * idx + 1)].set_ch('▁'); - self.content[(x, 3 * idx + 1)].set_bg(bg_color); + self.content[(x, 3 * idx + 1)] + .set_ch('▁') + .set_fg(fg_color) + .set_bg(bg_color); } /* draw from */ let (x, _) = write_string_to_grid( @@ -788,13 +792,16 @@ impl ConversationsListing { ); for x in x..width { - self.content[(x, 3 * idx + 1)].set_ch('▁'); - self.content[(x, 3 * idx + 1)].set_bg(bg_color); + self.content[(x, 3 * idx + 1)] + .set_ch('▁') + .set_fg(fg_color) + .set_bg(bg_color); } for x in 0..width { - self.content[(x, 3 * idx + 2)].set_ch('▓'); - self.content[(x, 3 * idx + 2)].set_fg(padding_fg); - self.content[(x, 3 * idx + 2)].set_bg(bg_color); + self.content[(x, 3 * idx + 2)] + .set_ch('▓') + .set_fg(padding_fg) + .set_bg(bg_color); } } if self.length == 0 && self.filter_term.is_empty() { diff --git a/ui/src/terminal/cells.rs b/ui/src/terminal/cells.rs index 7777ec2b8..9e7b91611 100644 --- a/ui/src/terminal/cells.rs +++ b/ui/src/terminal/cells.rs @@ -740,7 +740,7 @@ impl Color { | b @ Color::Cyan | b @ Color::White | b @ Color::Default => AnsiValue(b.as_byte()), - Color::Byte(b) => AnsiValue(b as u8), + Color::Byte(b) => AnsiValue(b), Color::Rgb(_, _, _) => AnsiValue(0), } }