Skip to content

Commit

Permalink
fix: Display offset for filenames with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeboehm committed Oct 20, 2023
1 parent 1a508be commit 55ae12d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/output/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,23 @@ impl<'a> Render<'a> {
0
};

let offset = if file.name.contains(' ') { 2 } else { 0 };

let contents = filename.paint();
let width = match (
filename.options.embed_hyperlinks,
filename.options.show_icons,
) {
#[rustfmt::skip]
(EmbedHyperlinks::On, ShowIcons::Always(spacing)
| ShowIcons::Automatic(spacing)) => filename.bare_width() + classification_width + 1 + (spacing as usize),
| ShowIcons::Automatic(spacing)) => filename.bare_width() + classification_width + 1 + (spacing as usize) + offset,
(EmbedHyperlinks::On, ShowIcons::Never) => {
filename.bare_width() + classification_width
filename.bare_width() + classification_width + offset
}
(
EmbedHyperlinks::Off,
ShowIcons::Always(spacing) | ShowIcons::Automatic(spacing),
) => filename.bare_width() + 1 + (spacing as usize),
) => filename.bare_width() + 1 + (spacing as usize) + offset,
(EmbedHyperlinks::Off, _) => *contents.width(),
};

Expand Down

0 comments on commit 55ae12d

Please sign in to comment.