|
|
@@ -121,6 +121,12 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
}
|
|
|
|
|
|
if !self.file.name.is_empty() {
|
|
|
+ // The “missing file” colour seems like it should be used here,
|
|
|
+ // but it’s not! In a grid view, where there's no space to display
|
|
|
+ // link targets, the filename has to have a different style to
|
|
|
+ // indicate this fact. But when showing targets, we can just
|
|
|
+ // colour the path instead (see below), and leave the broken
|
|
|
+ // link’s filename as the link colour.
|
|
|
for bit in self.coloured_file_name() {
|
|
|
bits.push(bit);
|
|
|
}
|
|
|
@@ -155,7 +161,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
|
|
|
FileTarget::Broken(ref broken_path) => {
|
|
|
bits.push(Style::default().paint(" "));
|
|
|
- bits.push(self.colours.broken_arrow().paint("->"));
|
|
|
+ bits.push(self.colours.broken_symlink().paint("->"));
|
|
|
bits.push(Style::default().paint(" "));
|
|
|
escape(broken_path.display().to_string(), &mut bits, self.colours.broken_filename(), self.colours.broken_control_char());
|
|
|
},
|
|
|
@@ -229,15 +235,13 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
|
|
|
|
|
|
/// Figures out which colour to paint the filename part of the output,
|
|
|
/// depending on which “type” of file it appears to be -- either from the
|
|
|
- /// class on the filesystem or from its name.
|
|
|
+ /// class on the filesystem or from its name. (Or the broken link colour,
|
|
|
+ /// if there’s nowhere else for that fact to be shown.)
|
|
|
pub fn style(&self) -> Style {
|
|
|
- // Override the style with the “broken link” style when this file is
|
|
|
- // a link that we can’t follow for whatever reason. This is used when
|
|
|
- // there’s no other place to show that the link doesn’t work.
|
|
|
if let LinkStyle::JustFilenames = self.link_style {
|
|
|
if let Some(ref target) = self.target {
|
|
|
if target.is_broken() {
|
|
|
- return self.colours.broken_arrow();
|
|
|
+ return self.colours.broken_symlink();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -273,9 +277,10 @@ pub trait Colours: FiletypeColours {
|
|
|
/// The style to paint the arrow between a link and its target.
|
|
|
fn normal_arrow(&self) -> Style;
|
|
|
|
|
|
- /// The style to paint the arrow between a link and its target, when the
|
|
|
- /// link is broken.
|
|
|
- fn broken_arrow(&self) -> Style;
|
|
|
+ /// The style to paint the filenames of broken links in views that don’t
|
|
|
+ /// show link targets, and the style to paint the *arrow* between the link
|
|
|
+ /// and its target in views that *do* show link targets.
|
|
|
+ fn broken_symlink(&self) -> Style;
|
|
|
|
|
|
/// The style to paint the entire filename of a broken link.
|
|
|
fn broken_filename(&self) -> Style;
|