Skip to content

Commit

Permalink
fix: colour file kind indicators
Browse files Browse the repository at this point in the history
Uses the punctuation style.
  • Loading branch information
bee-plus authored and gierens committed Dec 4, 2024
1 parent 0862493 commit a0ce277
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/output/file_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {

if should_add_classify_char {
if let Some(class) = self.classify_char(target) {
bits.push(Style::default().paint(class));
bits.push(self.colours.classify_char().paint(class));
}
}
}
Expand All @@ -317,7 +317,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
}
} else if should_add_classify_char {
if let Some(class) = self.classify_char(self.file) {
bits.push(Style::default().paint(class));
bits.push(self.colours.classify_char().paint(class));
}
}

Expand Down Expand Up @@ -541,6 +541,9 @@ pub trait Colours: FiletypeColours {
/// The style to paint a directory that has a filesystem mounted on it.
fn mount_point(&self) -> Style;

/// The style to paint a file kind indicator.
fn classify_char(&self) -> Style;

fn colour_file(&self, file: &File<'_>) -> Style;

fn style_override(&self, file: &File<'_>) -> Option<FileNameStyle>;
Expand Down
1 change: 1 addition & 0 deletions src/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ impl FileNameColours for Theme {
fn broken_control_char(&self) -> Style { apply_overlay(self.ui.control_char(), self.ui.broken_path_overlay()) }
fn executable_file(&self) -> Style { self.ui.filekinds.unwrap_or_default().executable() }
fn mount_point(&self) -> Style { self.ui.filekinds.unwrap_or_default().mount_point() }
fn classify_char(&self) -> Style { self.ui.punctuation() }

fn colour_file(&self, file: &File<'_>) -> Style {
self.exts
Expand Down

0 comments on commit a0ce277

Please sign in to comment.