ui: correct row highlighting in CompactListing

jmap
Manos Pitsidianakis 2019-11-16 13:41:33 +02:00
parent 321be8555f
commit 0d03116e8a
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 19 additions and 5 deletions

View File

@ -99,7 +99,11 @@ impl ListingTrait for CompactListing {
let threads = &account.collection.threads[&folder_hash];
let thread_node = &threads.thread_nodes[&i];
let fg_color = self.data_columns.columns[0][(0, idx)].fg();
let fg_color = if thread_node.has_unseen() {
Color::Byte(0)
} else {
Color::Default
};
let bg_color = if context.settings.terminal.theme == "light" {
if self.cursor_pos.2 == idx {
Color::Byte(244)
@ -107,8 +111,10 @@ impl ListingTrait for CompactListing {
Color::Byte(210)
} else if thread_node.has_unseen() {
Color::Byte(251)
} else if idx % 2 == 0 {
Color::Byte(252)
} else {
self.data_columns.columns[0][(0, idx)].bg()
Color::Default
}
} else {
if self.cursor_pos.2 == idx {
@ -116,9 +122,11 @@ impl ListingTrait for CompactListing {
} else if self.selection[&i] {
Color::Byte(210)
} else if thread_node.has_unseen() {
Color::Byte(251)
Color::Byte(253)
} else if idx % 2 == 0 {
Color::Byte(236)
} else {
self.data_columns.columns[0][(0, idx)].bg()
Color::Default
}
};
@ -295,8 +303,14 @@ impl ListingTrait for CompactListing {
}
for r in 0..cmp::min(self.length - top_idx, rows) {
let (fg_color, bg_color) = {
let thread_hash = self.get_thread_under_cursor(r + top_idx, context);
let c = &self.data_columns.columns[0][(0, r + top_idx)];
(c.fg(), c.bg())
if self.selection[&thread_hash] {
(c.fg(), Color::Byte(210))
} else {
(c.fg(), c.bg())
}
};
change_colors(
grid,