Fix kv table width issue with header_on_border configuration (#13325)

GOOD CATCH.............................................................
SORRY

I've added a test to catch regression just in case.

close #13319

cc: @fdncred
This commit is contained in:
Maxim Zhiburt
2024-07-09 17:49:04 +03:00
committed by GitHub
parent 1964dacaef
commit 4cdceca1f7
2 changed files with 16 additions and 4 deletions

View File

@ -2889,3 +2889,9 @@ fn table_list() {
let actual = nu!("table --list --theme basic");
assert_eq!(actual.out, "╭────┬────────────────╮│ 0 │ basic ││ 1 │ compact ││ 2 │ compact_double ││ 3 │ default ││ 4 │ heavy ││ 5 │ light ││ 6 │ none ││ 7 │ reinforced ││ 8 │ rounded ││ 9 │ thin ││ 10 │ with_love ││ 11 │ psql ││ 12 │ markdown ││ 13 │ dots ││ 14 │ restructured ││ 15 │ ascii_rounded ││ 16 │ basic_compact │╰────┴────────────────╯");
}
#[test]
fn table_kv_header_on_separator_trim_algorithm() {
let actual = nu!("$env.config.table.header_on_separator = true; {key1: '111111111111111111111111111111111111111111111111111111111111'} | table --width=60 --theme basic");
assert_eq!(actual.out, "+------+---------------------------------------------------+| key1 | 1111111111111111111111111111111111111111111111111 || | 11111111111 |+------+---------------------------------------------------+");
}