Give control characters their own colour

This commit is contained in:
Benjamin Sago 2017-05-01 15:10:39 +01:00
parent eb7e53ef6c
commit 4249cf0fcc
2 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ pub struct Colours {
pub symlink_path: Style,
pub broken_arrow: Style,
pub broken_filename: Style,
pub control_char: Style,
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
@ -170,7 +171,8 @@ impl Colours {
symlink_path: Cyan.normal(),
broken_arrow: Red.normal(),
broken_filename: Red.underline()
broken_filename: Red.underline(),
control_char: Red.normal(),
}
}

View File

@ -126,7 +126,7 @@ fn coloured_file_name<'a>(file: &File, colours: &Colours) -> Vec<ANSIString<'a>>
bits.push(colour.paint(s));
} else {
let s = c.escape_default().collect::<String>();
bits.push(colours.broken_arrow.paint(s));
bits.push(colours.control_char.paint(s));
}
}
}