diff --git a/src/output/grid.rs b/src/output/grid.rs index 5f43f5f70..7f76b1e77 100644 --- a/src/output/grid.rs +++ b/src/output/grid.rs @@ -56,22 +56,30 @@ impl<'a> Render<'a> { 0 }; + let space_filename_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), - (EmbedHyperlinks::On, ShowIcons::Never) => { - filename.bare_width() + classification_width - } + ( + EmbedHyperlinks::On, + ShowIcons::Always(spacing) | ShowIcons::Automatic(spacing) + ) => filename.bare_width() + classification_width + 1 + (spacing as usize) + space_filename_offset, + ( + EmbedHyperlinks::On, + ShowIcons::Never + ) => filename.bare_width() + classification_width + space_filename_offset, ( EmbedHyperlinks::Off, ShowIcons::Always(spacing) | ShowIcons::Automatic(spacing), - ) => filename.bare_width() + 1 + (spacing as usize), - (EmbedHyperlinks::Off, _) => *contents.width(), + ) => filename.bare_width() + 1 + (spacing as usize) + space_filename_offset, + ( + EmbedHyperlinks::Off, + _ + ) => *contents.width(), }; grid.add(tg::Cell {