diff --git a/src/output/grid_details.rs b/src/output/grid_details.rs index 71c6bb8bb..03b24602d 100644 --- a/src/output/grid_details.rs +++ b/src/output/grid_details.rs @@ -143,11 +143,11 @@ impl<'a> Render<'a> { let cells = rows .into_iter() - .zip(self.files) + .zip(&self.files) .map(|(row, file)| { let filename = self .file_style - .for_file(&file, self.theme) + .for_file(file, self.theme) .paint() .strings() .to_string(); @@ -178,6 +178,41 @@ impl<'a> Render<'a> { }, ); + // If a minimum grid rows threshold has been set + // via the `EZA_GRID_ROWS` environment variable + // and the grid is going to get rendered with fewer rows, + // then render a details list view instead. + if let RowThreshold::MinimumRows(minimum_rows) = self.row_threshold { + if grid.row_count() < minimum_rows { + let Self { + dir, + files, + theme, + file_style, + details: opts, + filter, + git_ignoring, + git, + git_repos, + .. + } = self; + + let r = DetailsRender { + dir, + files, + theme, + file_style, + opts, + recurse: None, + filter, + git_ignoring, + git, + git_repos, + }; + return r.render(w); + } + } + if self.details.header { let row = table.header_row(); let name = TextCell::paint_str(self.theme.ui.header, "Name")