ConversationsListing: fix invalid update_line colors
parent
99fbac3806
commit
f9efaea0ec
|
@ -26,64 +26,66 @@ use std::iter::FromIterator;
|
||||||
|
|
||||||
macro_rules! row_attr {
|
macro_rules! row_attr {
|
||||||
($field:ident, $color_cache:expr, $unseen:expr, $highlighted:expr, $selected:expr $(,)*) => {{
|
($field:ident, $color_cache:expr, $unseen:expr, $highlighted:expr, $selected:expr $(,)*) => {{
|
||||||
let fg = if $unseen {
|
ThemeAttribute {
|
||||||
$color_cache.unseen.fg
|
fg: if $highlighted {
|
||||||
} else if $highlighted {
|
$color_cache.highlighted.fg
|
||||||
$color_cache.highlighted.fg
|
} else if $selected {
|
||||||
} else if $selected {
|
$color_cache.selected.fg
|
||||||
$color_cache.selected.fg
|
} else if $unseen {
|
||||||
} else {
|
$color_cache.unseen.fg
|
||||||
$color_cache.$field.fg
|
} else {
|
||||||
};
|
$color_cache.$field.fg
|
||||||
let bg = if $unseen {
|
},
|
||||||
$color_cache.unseen.bg
|
bg: if $highlighted {
|
||||||
} else if $highlighted {
|
$color_cache.highlighted.bg
|
||||||
$color_cache.highlighted.bg
|
} else if $selected {
|
||||||
} else if $selected {
|
$color_cache.selected.bg
|
||||||
$color_cache.selected.bg
|
} else if $unseen {
|
||||||
} else {
|
$color_cache.unseen.bg
|
||||||
$color_cache.$field.bg
|
} else {
|
||||||
};
|
$color_cache.$field.bg
|
||||||
let attrs = if $unseen {
|
},
|
||||||
$color_cache.unseen.attrs
|
attrs: if $highlighted {
|
||||||
} else if $highlighted {
|
$color_cache.highlighted.attrs
|
||||||
$color_cache.highlighted.attrs
|
} else if $selected {
|
||||||
} else if $selected {
|
$color_cache.selected.attrs
|
||||||
$color_cache.selected.attrs
|
} else if $unseen {
|
||||||
} else {
|
$color_cache.unseen.attrs
|
||||||
$color_cache.$field.attrs
|
} else {
|
||||||
};
|
$color_cache.$field.attrs
|
||||||
ThemeAttribute { fg, bg, attrs }
|
},
|
||||||
|
}
|
||||||
}};
|
}};
|
||||||
($color_cache:expr, $unseen:expr, $highlighted:expr, $selected:expr $(,)*) => {{
|
($color_cache:expr, $unseen:expr, $highlighted:expr, $selected:expr $(,)*) => {{
|
||||||
let fg = if $unseen {
|
ThemeAttribute {
|
||||||
$color_cache.unseen.fg
|
fg: if $highlighted {
|
||||||
} else if $highlighted {
|
$color_cache.highlighted.fg
|
||||||
$color_cache.highlighted.fg
|
} else if $selected {
|
||||||
} else if $selected {
|
$color_cache.selected.fg
|
||||||
$color_cache.selected.fg
|
} else if $unseen {
|
||||||
} else {
|
$color_cache.unseen.fg
|
||||||
$color_cache.theme_default.fg
|
} else {
|
||||||
};
|
$color_cache.theme_default.fg
|
||||||
let bg = if $unseen {
|
},
|
||||||
$color_cache.unseen.bg
|
bg: if $highlighted {
|
||||||
} else if $highlighted {
|
$color_cache.highlighted.bg
|
||||||
$color_cache.highlighted.bg
|
} else if $selected {
|
||||||
} else if $selected {
|
$color_cache.selected.bg
|
||||||
$color_cache.selected.bg
|
} else if $unseen {
|
||||||
} else {
|
$color_cache.unseen.bg
|
||||||
$color_cache.theme_default.bg
|
} else {
|
||||||
};
|
$color_cache.theme_default.bg
|
||||||
let attrs = if $unseen {
|
},
|
||||||
$color_cache.unseen.attrs
|
attrs: if $highlighted {
|
||||||
} else if $highlighted {
|
$color_cache.highlighted.attrs
|
||||||
$color_cache.highlighted.attrs
|
} else if $selected {
|
||||||
} else if $selected {
|
$color_cache.selected.attrs
|
||||||
$color_cache.selected.attrs
|
} else if $unseen {
|
||||||
} else {
|
$color_cache.unseen.attrs
|
||||||
$color_cache.theme_default.attrs
|
} else {
|
||||||
};
|
$color_cache.theme_default.attrs
|
||||||
ThemeAttribute { fg, bg, attrs }
|
},
|
||||||
|
}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,7 +1059,7 @@ impl ConversationsListing {
|
||||||
}
|
}
|
||||||
let subject_attr = row_attr!(subject, self.color_cache, thread.unseen() > 0, false, false);
|
let subject_attr = row_attr!(subject, self.color_cache, thread.unseen() > 0, false, false);
|
||||||
/* draw subject */
|
/* draw subject */
|
||||||
let (x, _) = write_string_to_grid(
|
let (mut x, _) = write_string_to_grid(
|
||||||
&strings.subject,
|
&strings.subject,
|
||||||
&mut self.content,
|
&mut self.content,
|
||||||
subject_attr.fg,
|
subject_attr.fg,
|
||||||
|
@ -1066,40 +1068,34 @@ impl ConversationsListing {
|
||||||
((x, 3 * idx), (width - 1, 3 * idx)),
|
((x, 3 * idx), (width - 1, 3 * idx)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
let x = {
|
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||||
let mut x = x + 1;
|
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
let (_x, _) = write_string_to_grid(
|
||||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
t,
|
||||||
let (_x, _) = write_string_to_grid(
|
&mut self.content,
|
||||||
t,
|
self.color_cache.tag_default.fg,
|
||||||
&mut self.content,
|
color,
|
||||||
self.color_cache.tag_default.fg,
|
self.color_cache.tag_default.attrs,
|
||||||
color,
|
((x + 1, 3 * idx), (width - 1, 3 * idx)),
|
||||||
self.color_cache.tag_default.attrs,
|
None,
|
||||||
((x + 1, 3 * idx), (width - 1, 3 * idx)),
|
);
|
||||||
None,
|
self.content[(x, 3 * idx)].set_bg(color);
|
||||||
);
|
if _x < width {
|
||||||
for c in self.content.row_iter(x..(x + 1), 3 * idx) {
|
self.content[(_x, 3 * idx)].set_bg(color).set_keep_bg(true);
|
||||||
self.content[c].set_bg(color);
|
|
||||||
}
|
|
||||||
for c in self.content.row_iter(_x..(_x + 1), 3 * idx) {
|
|
||||||
self.content[c].set_bg(color);
|
|
||||||
self.content[c].set_keep_bg(true);
|
|
||||||
}
|
|
||||||
for c in self.content.row_iter(x + 1..(_x + 1), 3 * idx) {
|
|
||||||
self.content[c].set_keep_fg(true);
|
|
||||||
self.content[c].set_keep_bg(true);
|
|
||||||
}
|
|
||||||
for c in self.content.row_iter(x..(x + 1), 3 * idx) {
|
|
||||||
self.content[c].set_keep_bg(true);
|
|
||||||
}
|
|
||||||
x = _x + 1;
|
|
||||||
}
|
}
|
||||||
x
|
for x in (x + 1).._x {
|
||||||
};
|
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 c in self.content.row_iter(x..width, 3 * idx) {
|
for c in self.content.row_iter(x..width, 3 * idx) {
|
||||||
self.content[c].set_ch(' ');
|
self.content[c]
|
||||||
self.content[c].set_bg(row_attr.bg);
|
.set_ch(' ')
|
||||||
|
.set_fg(row_attr.fg)
|
||||||
|
.set_bg(row_attr.bg);
|
||||||
}
|
}
|
||||||
let date_attr = row_attr!(date, self.color_cache, thread.unseen() > 0, false, false);
|
let date_attr = row_attr!(date, self.color_cache, thread.unseen() > 0, false, false);
|
||||||
/* Next line, draw date */
|
/* Next line, draw date */
|
||||||
|
@ -1112,9 +1108,11 @@ impl ConversationsListing {
|
||||||
((0, 3 * idx + 1), (width - 1, 3 * idx + 1)),
|
((0, 3 * idx + 1), (width - 1, 3 * idx + 1)),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
for c in self.content.row_iter(x..(x + 5), 3 * idx + 1) {
|
for c in self.content.row_iter(x..(x + 4), 3 * idx + 1) {
|
||||||
self.content[c].set_ch('▁');
|
self.content[c]
|
||||||
self.content[c].set_bg(row_attr.bg);
|
.set_ch('▁')
|
||||||
|
.set_fg(row_attr.fg)
|
||||||
|
.set_bg(row_attr.bg);
|
||||||
}
|
}
|
||||||
let from_attr = row_attr!(from, self.color_cache, thread.unseen() > 0, false, false);
|
let from_attr = row_attr!(from, self.color_cache, thread.unseen() > 0, false, false);
|
||||||
/* draw from */
|
/* draw from */
|
||||||
|
@ -1129,13 +1127,16 @@ impl ConversationsListing {
|
||||||
);
|
);
|
||||||
|
|
||||||
for c in self.content.row_iter(x..width, 3 * idx + 1) {
|
for c in self.content.row_iter(x..width, 3 * idx + 1) {
|
||||||
self.content[c].set_ch('▁');
|
self.content[c]
|
||||||
self.content[c].set_bg(row_attr.bg);
|
.set_ch('▁')
|
||||||
|
.set_fg(row_attr.fg)
|
||||||
|
.set_bg(row_attr.bg);
|
||||||
}
|
}
|
||||||
for c in self.content.row_iter(0..width, 3 * idx + 2) {
|
for c in self.content.row_iter(0..width, 3 * idx + 2) {
|
||||||
self.content[c].set_ch('▓');
|
self.content[c]
|
||||||
self.content[c].set_fg(padding_fg);
|
.set_ch('▓')
|
||||||
self.content[c].set_bg(row_attr.bg);
|
.set_fg(padding_fg)
|
||||||
|
.set_bg(row_attr.bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1512,9 +1512,11 @@ impl Default for Themes {
|
||||||
"mail.listing.conversations.highlighted",
|
"mail.listing.conversations.highlighted",
|
||||||
dark = {
|
dark = {
|
||||||
bg: Color::Byte(246),
|
bg: Color::Byte(246),
|
||||||
|
attrs: Attr::BOLD,
|
||||||
},
|
},
|
||||||
light = {
|
light = {
|
||||||
bg: Color::Byte(246)
|
bg: Color::Byte(246),
|
||||||
|
attrs: Attr::BOLD,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
add!("mail.listing.conversations.selected",
|
add!("mail.listing.conversations.selected",
|
||||||
|
|
Loading…
Reference in New Issue