mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
Patch restore lead trail space bg color (#10351)
```nu $env.config.color_config.leading_trailing_space_bg = { bg: 'white' }; [[a b, 'c ']; [' 1 ' ' 2' '3 '] [' 4 ' "hello \n world " [' 1 ' 2 [1 ' 2 ' 3]]]] | table --expand ```  ref: #2794 close: #10317 note: test are not actually make scenes cause `nu!` strips colors. (Ideally it would need a flag to not do so) note: It does does does ... slower down quite a bit rendering... ( PS: Maybe it's better being a flag to `table` rather then a configuration option? PS: I am not sure why the logic was removed in a first place
This commit is contained in:
@ -2664,3 +2664,25 @@ fn table_collapse_padding_zero() {
|
||||
╰─┴─┴─╯"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn table_leading_trailing_space_bg() {
|
||||
let actual = nu!(
|
||||
r#"$env.config.color_config.leading_trailing_space_bg = { bg: 'white' }; [[a b, 'c ']; [' 1 ' ' 2' '3 '] [' 4 ' "hello\nworld" [' 1 ' 2 [1 ' 2 ' 3]]]] | table"#
|
||||
);
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"╭───┬───────┬───────┬────────────────╮│ # │ a │ b │ c │├───┼───────┼───────┼────────────────┤│ 0 │ 1 │ 2 │ 3 ││ 1 │ 4 │ hello │ [list 3 items] ││ │ │ world │ │╰───┴───────┴───────┴────────────────╯"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn table_leading_trailing_space_bg_expand() {
|
||||
let actual = nu!(
|
||||
r#"$env.config.color_config.leading_trailing_space_bg = { bg: 'white' }; [[a b, 'c ']; [' 1 ' ' 2' '3 '] [' 4 ' "hello\nworld" [' 1 ' 2 [1 ' 2 ' 3]]]] | table --expand"#
|
||||
);
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"╭───┬───────┬───────┬───────────────────────╮│ # │ a │ b │ c │├───┼───────┼───────┼───────────────────────┤│ 0 │ 1 │ 2 │ 3 ││ 1 │ 4 │ hello │ ╭───┬───────────────╮ ││ │ │ world │ │ 0 │ 1 │ ││ │ │ │ │ 1 │ 2 │ ││ │ │ │ │ 2 │ ╭───┬───────╮ │ ││ │ │ │ │ │ │ 0 │ 1 │ │ ││ │ │ │ │ │ │ 1 │ 2 │ │ ││ │ │ │ │ │ │ 2 │ 3 │ │ ││ │ │ │ │ │ ╰───┴───────╯ │ ││ │ │ │ ╰───┴───────────────╯ │╰───┴───────┴───────┴───────────────────────╯"
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user