mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-27 02:12:53 +00:00
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:
parent
f1e3e7c7ff
commit
67a6cdd46a
@ -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));
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user