Make icon styles appropriate for all file types

exa now bases the icon style for a file on its file name and kind in all cases, rather than just on its file name. This means that directories and symlinks have the correctly-coloured icon.

It also only takes the foreground colour into account while styling the icon, to make sure they're not bold or underlined.

Fixes GH-528.
This commit is contained in:
Benjamin Sago 2020-10-24 18:16:38 +01:00
parent f1e3e7c7ff
commit 67a6cdd46a
2 changed files with 4 additions and 14 deletions

View File

@ -113,7 +113,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
let mut bits = Vec::new();
if self.options.icons {
let style = iconify_style(self.colours.colour_file(self.file));
let style = iconify_style(self.style());
let file_icon = icon_for_file(self.file).to_string();
bits.push(style.paint(file_icon));

View File

@ -28,19 +28,9 @@ impl Icons {
pub fn iconify_style<'a>(style: Style) -> Style {
if style.is_underline {
match style.foreground {
Some(color) => {
Style::from(color)
}
None => {
Style::default()
}
}
}
else {
style
}
style.foreground
.map(Style::from)
.unwrap_or_default()
}