mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 13:56:27 +00:00
Rename broken_arrow to broken_symlink
This commit is contained in:
parent
91334d601c
commit
a45bcfe058
@ -334,7 +334,9 @@ impl<'a> Render<'a> {
|
||||
None => format!("<{}>", error),
|
||||
};
|
||||
|
||||
let name = TextCell::paint(self.colours.broken_arrow(), error_message);
|
||||
// TODO: broken_symlink() doesn’t quite seem like the right name for
|
||||
// the style that’s being used here. Maybe split it in two?
|
||||
let name = TextCell::paint(self.colours.broken_symlink(), error_message);
|
||||
Row { cells: None, name, tree }
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -393,7 +393,7 @@ impl render::UserColours for Colours {
|
||||
|
||||
impl FileNameColours for Colours {
|
||||
fn normal_arrow(&self) -> Style { self.punctuation }
|
||||
fn broken_arrow(&self) -> Style { self.broken_symlink }
|
||||
fn broken_symlink(&self) -> Style { self.broken_symlink }
|
||||
fn broken_filename(&self) -> Style { apply_overlay(self.broken_symlink, self.broken_path_overlay) }
|
||||
fn broken_control_char(&self) -> Style { apply_overlay(self.control_char, self.broken_path_overlay) }
|
||||
fn control_char(&self) -> Style { self.control_char }
|
||||
|
Loading…
Reference in New Issue
Block a user