From b411daddaa8c3c3b76c206f5e8c44a1771c9577a Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Fri, 13 Nov 2020 18:34:50 +0200 Subject: [PATCH] listing/conversations: remove entry padding box character MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove padding each entry with '░' box character. --- docs/meli-themes.5 | 4 -- docs/samples/themes/orca.toml | 2 - docs/samples/themes/spooky.toml | 2 - docs/samples/themes/watermelon.toml | 2 - src/components/mail/listing.rs | 2 - src/components/mail/listing/conversations.rs | 49 +++++++------------- src/conf/themes.rs | 24 ---------- 7 files changed, 16 insertions(+), 69 deletions(-) diff --git a/docs/meli-themes.5 b/docs/meli-themes.5 index 864fced0..d2b5499f 100644 --- a/docs/meli-themes.5 +++ b/docs/meli-themes.5 @@ -251,12 +251,8 @@ mail.listing.conversations.from .It mail.listing.conversations.date .It -mail.listing.conversations.padding -.It mail.listing.conversations.unseen .It -mail.listing.conversations.unseen_padding -.It mail.listing.conversations.highlighted .It mail.listing.conversations.selected diff --git a/docs/samples/themes/orca.toml b/docs/samples/themes/orca.toml index 82c707ec..c8722605 100644 --- a/docs/samples/themes/orca.toml +++ b/docs/samples/themes/orca.toml @@ -14,11 +14,9 @@ color_aliases = { "neon_green" = "#6ef9d4", "darkgrey" = "#4a4a4a", "neon_purp "mail.listing.conversations.date" = { fg = "$neon_purple", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.from" = { fg = "$darkgrey", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.highlighted" = { fg = "theme_default", bg = "Grey58", attrs = "theme_default" } -"mail.listing.conversations.padding" = { fg = "Black", bg = "Black", attrs = "theme_default" } "mail.listing.conversations.selected" = { fg = "theme_default", bg = "LightCoral", attrs = "theme_default" } "mail.listing.conversations.subject" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.unseen" = { fg = "Black", bg = "Grey78", attrs = "theme_default" } -"mail.listing.conversations.unseen_padding" = { fg = "Black", bg = "Black", attrs = "theme_default" } "mail.listing.plain.even" = { fg = "theme_default", bg = "Grey19", attrs = "theme_default" } "mail.listing.plain.even_highlighted" = { fg = "theme_default", bg = "Grey58", attrs = "theme_default" } "mail.listing.plain.even_selected" = { fg = "theme_default", bg = "LightCoral", attrs = "theme_default" } diff --git a/docs/samples/themes/spooky.toml b/docs/samples/themes/spooky.toml index b04ed06a..d0285929 100644 --- a/docs/samples/themes/spooky.toml +++ b/docs/samples/themes/spooky.toml @@ -13,11 +13,9 @@ "mail.listing.conversations" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.from" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.highlighted" = { fg = "theme_default", bg = "Grey58", attrs = "theme_default" } -"mail.listing.conversations.padding" = { fg = "Grey15", bg = "Grey15", attrs = "theme_default" } "mail.listing.conversations.selected" = { fg = "theme_default", bg = "LightCoral", attrs = "theme_default" } "mail.listing.conversations.subject" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.unseen" = { fg = "Black", bg = "Grey78", attrs = "theme_default" } -"mail.listing.conversations.unseen_padding" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.plain.even" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.plain.odd" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.plain.even_unseen" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } diff --git a/docs/samples/themes/watermelon.toml b/docs/samples/themes/watermelon.toml index 45acb843..f1827723 100644 --- a/docs/samples/themes/watermelon.toml +++ b/docs/samples/themes/watermelon.toml @@ -16,11 +16,9 @@ color_aliases = { "JewelGreen" = "#157241", "PinkLace" = "#FFD5FD", "TorchRed" = "mail.listing.conversations" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.from" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.highlighted" = { fg = "$JewelGreen", bg = "$SunsetOrange", attrs = "theme_default" } -"mail.listing.conversations.padding" = { fg = "$TorchRed", bg = "Grey15", attrs = "theme_default" } "mail.listing.conversations.selected" = { fg = "theme_default", bg = "LightCoral", attrs = "theme_default" } "mail.listing.conversations.subject" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.conversations.unseen" = { fg = "Black", bg = "mail.listing.compact.even_unseen", attrs = "theme_default" } -"mail.listing.conversations.unseen_padding" = { fg = "$BlueStone", bg = "mail.listing.conversations.unseen", attrs = "theme_default" } "mail.listing.plain.even" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.plain.odd" = { fg = "theme_default", bg = "theme_default", attrs = "theme_default" } "mail.listing.plain.even_unseen" = { fg = "theme_default", bg = "mail.listing.compact.even_unseen", attrs = "theme_default" } diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs index 7229dab1..ff483b64 100644 --- a/src/components/mail/listing.rs +++ b/src/components/mail/listing.rs @@ -88,8 +88,6 @@ struct ColorCache { subject: ThemeAttribute, from: ThemeAttribute, date: ThemeAttribute, - padding: ThemeAttribute, - unseen_padding: ThemeAttribute, } #[derive(Debug)] diff --git a/src/components/mail/listing/conversations.rs b/src/components/mail/listing/conversations.rs index eae0b3db..93ffe735 100644 --- a/src/components/mail/listing/conversations.rs +++ b/src/components/mail/listing/conversations.rs @@ -172,13 +172,8 @@ impl MailListingTrait for ConversationsListing { subject: crate::conf::value(context, "mail.listing.conversations.subject"), from: crate::conf::value(context, "mail.listing.conversations.from"), date: crate::conf::value(context, "mail.listing.conversations.date"), - padding: crate::conf::value(context, "mail.listing.conversations.padding"), selected: crate::conf::value(context, "mail.listing.conversations.selected"), unseen: crate::conf::value(context, "mail.listing.conversations.unseen"), - unseen_padding: crate::conf::value( - context, - "mail.listing.conversations.unseen_padding", - ), highlighted: crate::conf::value(context, "mail.listing.conversations.highlighted"), attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"), thread_snooze_flag: crate::conf::value(context, "mail.listing.thread_snooze_flag"), @@ -350,8 +345,6 @@ impl MailListingTrait for ConversationsListing { let width = max_entry_columns; self.content = CellBuffer::new_with_context(width, 4 * rows.len(), None, context); - let padding_fg = self.color_cache.padding.fg; - for ((idx, (thread_hash, root_env_hash)), strings) in rows { if !context.accounts[&self.cursor_pos.0].contains_key(root_env_hash) { panic!(); @@ -472,8 +465,8 @@ impl MailListingTrait for ConversationsListing { } for x in 0..width { self.content[(x, 3 * idx + 2)] - .set_ch('▓') - .set_fg(padding_fg) + .set_ch(Self::PADDING_CHAR) + .set_fg(row_attr.fg) .set_bg(row_attr.bg); } } @@ -525,12 +518,6 @@ impl ListingTrait for ConversationsListing { self.selection[&thread_hash] ); - let padding_fg = if thread.unseen() > 0 { - self.color_cache.unseen_padding.fg - } else { - self.color_cache.padding.fg - }; - copy_area( grid, &self.content, @@ -553,7 +540,7 @@ impl ListingTrait for ConversationsListing { .set_attrs(row_attr.attrs); grid[(x, y + 2)] - .set_fg(padding_fg) + .set_fg(row_attr.fg) .set_bg(row_attr.bg) .set_attrs(row_attr.attrs); } @@ -572,7 +559,7 @@ impl ListingTrait for ConversationsListing { .set_attrs(row_attr.attrs); grid[(x, y + 2)] - .set_fg(padding_fg) + .set_fg(row_attr.fg) .set_bg(row_attr.bg) .set_attrs(row_attr.attrs); } @@ -716,35 +703,35 @@ impl ListingTrait for ConversationsListing { /* fill any remaining columns, if our view is wider than self.content */ let width = self.content.size().0; - let padding_fg = self.color_cache.padding.fg; if width < width!(area) { let y_offset = get_y(upper_left); for y in 0..rows { + let fg_color = grid[(get_x(upper_left) + width - 1, y_offset + 3 * y)].fg(); let bg_color = grid[(get_x(upper_left) + width - 1, y_offset + 3 * y)].bg(); for x in (get_x(upper_left) + width)..=get_x(bottom_right) { grid[(x, y_offset + 3 * y)].set_bg(bg_color); grid[(x, y_offset + 3 * y + 1)] .set_ch('▁') - .set_fg(self.color_cache.theme_default.fg) + .set_fg(fg_color) .set_bg(bg_color); grid[(x, y_offset + 3 * y + 2)] - .set_ch('▓') - .set_fg(padding_fg) + .set_ch(Self::PADDING_CHAR) + .set_fg(fg_color) .set_bg(bg_color); } } if pad > 0 { let y = 3 * rows; + let fg_color = grid[(get_x(upper_left) + width - 1, y_offset + y)].fg(); let bg_color = grid[(get_x(upper_left) + width - 1, y_offset + y)].bg(); for x in (get_x(upper_left) + width)..=get_x(bottom_right) { grid[(x, y_offset + y)].set_bg(bg_color); - grid[(x, y_offset + y + 1)].set_ch('▁'); - grid[(x, y_offset + y + 1)].set_bg(bg_color); + grid[(x, y_offset + y + 1)].set_ch('▁').set_bg(bg_color); if pad == 2 { grid[(x, y_offset + y + 2)] - .set_ch('▓') - .set_fg(padding_fg) + .set_ch(Self::PADDING_CHAR) + .set_fg(fg_color) .set_bg(bg_color); } } @@ -870,6 +857,8 @@ impl fmt::Display for ConversationsListing { impl ConversationsListing { const DESCRIPTION: &'static str = "conversations listing"; + const PADDING_CHAR: char = ' '; //░'; + pub fn new(coordinates: (AccountHash, MailboxHash)) -> Self { ConversationsListing { cursor_pos: (coordinates.0, 1, 0), @@ -1040,12 +1029,6 @@ impl ConversationsListing { self.selection[&thread_hash] ); - let padding_fg = if thread.unseen() > 0 { - self.color_cache.unseen_padding.fg - } else { - self.color_cache.padding.fg - }; - let mut from_address_list = Vec::new(); let mut from_address_set: std::collections::HashSet> = std::collections::HashSet::new(); @@ -1183,8 +1166,8 @@ impl ConversationsListing { } for c in self.content.row_iter(0..width, 3 * idx + 2) { self.content[c] - .set_ch('▓') - .set_fg(padding_fg) + .set_ch(Self::PADDING_CHAR) + .set_fg(row_attr.fg) .set_bg(row_attr.bg); } } diff --git a/src/conf/themes.rs b/src/conf/themes.rs index b44ce15c..8fb55cce 100644 --- a/src/conf/themes.rs +++ b/src/conf/themes.rs @@ -286,9 +286,7 @@ const DEFAULT_KEYS: &[&str] = &[ "mail.listing.conversations.subject", "mail.listing.conversations.from", "mail.listing.conversations.date", - "mail.listing.conversations.padding", "mail.listing.conversations.unseen", - "mail.listing.conversations.unseen_padding", "mail.listing.conversations.highlighted", "mail.listing.conversations.selected", "mail.view.headers", @@ -1517,28 +1515,6 @@ impl Default for Themes { fg: Color::Magenta, } ); - add!( - "mail.listing.conversations.padding", - dark = { - fg: Color::Byte(235), - bg: Color::Byte(235), - }, - light = { - fg: Color::Byte(254), - bg: Color::Byte(254), - } - ); - add!( - "mail.listing.conversations.unseen_padding", - dark = { - fg: Color::Byte(235), - bg: Color::Byte(235), - }, - light = { - fg: Color::Byte(254), - bg: Color::Byte(254), - } - ); add!( "mail.listing.conversations.unseen", dark = {