Fix unused space when truncation is used and header on border is configured (#13353)

Somehow this logic was missed on my end. ( I mean I was not even
thinking about it in original patch 😄 )

Please recheck

Added a regression test too.

close #13336

cc: @fdncred
This commit is contained in:
Maxim Zhiburt
2024-07-11 23:13:16 +03:00
committed by GitHub
parent ccd0160c32
commit 4bd87d0496
2 changed files with 76 additions and 19 deletions

View File

@ -2895,3 +2895,9 @@ 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 |+------+---------------------------------------------------+");
}
#[test]
fn table_general_header_on_separator_trim_algorithm() {
let actual = nu!("$env.config.table.header_on_separator = true; [[a b]; ['11111111111111111111111111111111111111' 2] ] | table --width=20 --theme basic");
assert_eq!(actual.out, "+-#-+----a-----+-b-+| 0 | 11111111 | 2 || | 11111111 | || | 11111111 | || | 11111111 | || | 111111 | |+---+----------+---+");
}