view/thread: use reverse colors in cursor in case of NO_COLOR

jmap-eventsource
Manos Pitsidianakis 2020-09-18 21:28:20 +03:00
parent 82cd690005
commit 7dfa6c0639
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 12 additions and 0 deletions

View File

@ -50,6 +50,7 @@ pub struct ThreadView {
entries: Vec<ThreadEntry>, entries: Vec<ThreadEntry>,
visible_entries: Vec<Vec<usize>>, visible_entries: Vec<Vec<usize>>,
indentation_colors: [ThemeAttribute; 6], indentation_colors: [ThemeAttribute; 6],
use_color: bool,
movement: Option<PageMovement>, movement: Option<PageMovement>,
dirty: bool, dirty: bool,
@ -91,6 +92,7 @@ impl ThreadView {
crate::conf::value(context, "mail.view.thread.indentation.e"), crate::conf::value(context, "mail.view.thread.indentation.e"),
crate::conf::value(context, "mail.view.thread.indentation.f"), crate::conf::value(context, "mail.view.thread.indentation.f"),
], ],
use_color: context.settings.terminal.use_color(),
..Default::default() ..Default::default()
}; };
view.initiate(expanded_hash, context); view.initiate(expanded_hash, context);
@ -420,6 +422,16 @@ impl ThreadView {
if idx == *visibles[self.cursor_pos] { if idx == *visibles[self.cursor_pos] {
let fg_color = Color::Default; let fg_color = Color::Default;
let bg_color = Color::Byte(246); let bg_color = Color::Byte(246);
let attrs = if self.use_color {
Attr::DEFAULT
} else {
Attr::REVERSE
};
for row in grid.bounds_iter(dest_area) {
for c in row {
grid[c].set_fg(fg_color).set_bg(bg_color).set_attrs(attrs);
}
}
change_colors(grid, dest_area, fg_color, bg_color); change_colors(grid, dest_area, fg_color, bg_color);
return; return;
} }