Fix EXA_GRID_ROWS not working in some cases

This commit is contained in:
ariasuni 2021-04-09 16:16:05 +02:00
parent 2aaead1721
commit c729e226da

View File

@ -174,22 +174,21 @@ impl<'a> Render<'a> {
}; };
if the_grid_fits { if the_grid_fits {
if column_count == file_names.len() {
return Some((grid, column_count));
} else {
last_working_grid = grid; last_working_grid = grid;
} }
} else {
// If weve figured out how many columns can fit in the users if !the_grid_fits || column_count == file_names.len() {
// terminal, and it turns out there arent enough rows to let last_column_count = if the_grid_fits { column_count } else { column_count - 1 };
// make it worthwhile, then just resort to the lines view. // If weve figured out how many columns can fit in the users terminal,
// and it turns out there arent enough rows to make it worthwhile
// (according to EXA_GRID_ROWS), then just resort to the lines view.
if let RowThreshold::MinimumRows(thresh) = self.row_threshold { if let RowThreshold::MinimumRows(thresh) = self.row_threshold {
if last_working_grid.fit_into_columns(column_count - 1).row_count() < thresh { if last_working_grid.fit_into_columns(last_column_count).row_count() < thresh {
return None; return None;
} }
} }
return Some((last_working_grid, column_count - 1)); return Some((last_working_grid, last_column_count));
} }
} }