diff --git a/src/output/file_name.rs b/src/output/file_name.rs index fa084f658..8ffb22d37 100644 --- a/src/output/file_name.rs +++ b/src/output/file_name.rs @@ -111,7 +111,7 @@ pub struct FileName<'a, 'dir, C> { /// How to handle displaying links. link_style: LinkStyle, - options: Options, + pub options: Options, } impl<'a, 'dir, C> FileName<'a, 'dir, C> { diff --git a/src/output/grid.rs b/src/output/grid.rs index 7c9bb468f..ae9a8caea 100644 --- a/src/output/grid.rs +++ b/src/output/grid.rs @@ -5,6 +5,7 @@ use term_grid as tg; use crate::fs::File; use crate::fs::filter::FileFilter; use crate::output::file_name::Options as FileStyle; +use crate::output::file_name::{ShowIcons, EmbedHyperlinks}; use crate::theme::Theme; @@ -43,12 +44,19 @@ impl<'a> Render<'a> { for file in &self.files { let filename = self.file_style.for_file(file, self.theme); let contents = filename.paint(); + let width; + + match (filename.options.embed_hyperlinks, filename.options.show_icons) { + (EmbedHyperlinks::On, ShowIcons::On(_)) => width = filename.bare_width() + 1, + (EmbedHyperlinks::On, ShowIcons::Off) => width = filename.bare_width(), + (EmbedHyperlinks::Off, _) => width = *contents.width(), + }; grid.add(tg::Cell { contents: contents.strings().to_string(), // with hyperlink escape sequences, // the actual *contents.width() is larger than actually needed, so we take only the filename - width: filename.bare_width(), + width: width, }); }