mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-25 13:27:33 +00:00
Merge pull request #836 from ariasuni/fix-exa-grid-rows
Fix `EXA_GRID_ROWS` not working in some cases
This commit is contained in:
commit
f3ae6a9bd9
@ -174,22 +174,21 @@ impl<'a> Render<'a> {
|
||||
};
|
||||
|
||||
if the_grid_fits {
|
||||
if column_count == file_names.len() {
|
||||
return Some((grid, column_count));
|
||||
} else {
|
||||
last_working_grid = grid;
|
||||
}
|
||||
} else {
|
||||
// If we’ve figured out how many columns can fit in the user’s
|
||||
// terminal, and it turns out there aren’t enough rows to
|
||||
// make it worthwhile, then just resort to the lines view.
|
||||
|
||||
if !the_grid_fits || column_count == file_names.len() {
|
||||
let last_column_count = if the_grid_fits { column_count } else { column_count - 1 };
|
||||
// If we’ve figured out how many columns can fit in the user’s terminal,
|
||||
// and it turns out there aren’t 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 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 Some((last_working_grid, column_count - 1));
|
||||
return Some((last_working_grid, last_column_count));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,19 +81,49 @@ tags = [ 'env', 'long', 'grid' ]
|
||||
# check if exa is using the minimum number of columns with headers
|
||||
|
||||
[[cmd]]
|
||||
name = "‘COLUMN=200 exa -lGh’ with one file don’t produce extra columns even if there place for more"
|
||||
name = "‘COLUMNS=200 exa -lGh’ with one file don’t produce extra columns even if there place for more"
|
||||
shell = "exa -lGh /testcases/files/10_bytes"
|
||||
environment = { COLUMNS = "200" }
|
||||
stdout = { file = "outputs/files_paths_long_grid_header_1file.ansitxt" }
|
||||
stdout = { file = "outputs/files_long_grid_header_1file.ansitxt" }
|
||||
stderr = { empty = true }
|
||||
status = 0
|
||||
tags = [ 'env', 'long', 'grid' ]
|
||||
|
||||
[[cmd]]
|
||||
name = "‘COLUMN=200 exa -lGh’ with several files don’t produce extra columns even if there place for more"
|
||||
name = "‘COLUMNS=200 exa -lGh’ with several files don’t produce extra columns even if there place for more"
|
||||
shell = "exa -lGh /testcases/files/10_{bytes,KiB}"
|
||||
environment = { COLUMNS = "200" }
|
||||
stdout = { file = "outputs/files_paths_long_grid_header_2files.ansitxt" }
|
||||
stdout = { file = "outputs/files_long_grid_header_2files.ansitxt" }
|
||||
stderr = { empty = true }
|
||||
status = 0
|
||||
tags = [ 'env', 'long', 'grid' ]
|
||||
|
||||
|
||||
# check if EXA_GRID_ROWS is working
|
||||
|
||||
[[cmd]]
|
||||
name = "‘COLUMNS=200 EXA_GRID_ROWS=2 exa -lG’ with three files produces a grid details of 1 column"
|
||||
shell = "exa -lG /testcases/files/1_*"
|
||||
environment = { COLUMNS = "200", EXA_GRID_ROWS = "2" }
|
||||
stdout = { file = "outputs/files_long_grid_exa_grid_rows_2_3files.ansitxt" }
|
||||
stderr = { empty = true }
|
||||
status = 0
|
||||
tags = [ 'env', 'long', 'grid' ]
|
||||
|
||||
[[cmd]]
|
||||
name = "‘COLUMNS=200 EXA_GRID_ROWS=5 exa -lG’ with 15 files produces a grid details of 3 columns"
|
||||
shell = "exa -lG /testcases/files/1*"
|
||||
environment = { COLUMNS = "200", EXA_GRID_ROWS = "5" }
|
||||
stdout = { file = "outputs/files_long_grid_exa_grid_rows_5_15files.ansitxt" }
|
||||
stderr = { empty = true }
|
||||
status = 0
|
||||
tags = [ 'env', 'long', 'grid' ]
|
||||
|
||||
[[cmd]]
|
||||
name = "‘COLUMNS=200 EXA_GRID_ROWS=6 exa -lG’ with 15 files produces a grid details of 1 column"
|
||||
shell = "exa -lG /testcases/files/1*"
|
||||
environment = { COLUMNS = "200", EXA_GRID_ROWS = "6" }
|
||||
stdout = { file = "outputs/files_long_grid_exa_grid_rows_6_15files.ansitxt" }
|
||||
stderr = { empty = true }
|
||||
status = 0
|
||||
tags = [ 'env', 'long', 'grid' ]
|
||||
|
@ -0,0 +1,3 @@
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1.0[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1.0[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_MiB
|
@ -0,0 +1,5 @@
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m10[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m10_bytes .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m12[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m11_MiB .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m13[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m13_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m10[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m10_KiB .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m12[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m12_bytes .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m14[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m13_MiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m10[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m10_MiB .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m12[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m12_KiB .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m11[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m11_bytes .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m13[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m12_MiB .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1.0[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m11[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m11_KiB .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m13[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m13_bytes .[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1.0[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_MiB
|
@ -0,0 +1,15 @@
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1.0[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m1.0[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m1_MiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m10[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m10_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m10[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m10_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m10[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m10_MiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m11[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m11_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m11[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m11_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m12[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m11_MiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m12[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m12_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m12[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m12_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m13[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m12_MiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m13[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m13_bytes
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m13[0m[32mk[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m13_KiB
|
||||
.[1;33mr[31mw[0m[38;5;244m-[33mr[38;5;244m--[33mr[38;5;244m--[0m [1;32m14[0m[32mM[0m cassowary [34m 1 Jan 12:34[0m [36m/testcases/files/[0m13_MiB
|
Loading…
Reference in New Issue
Block a user