nu-table: Fix a term_width value (#5997)

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
Maxim Zhiburt 2022-07-09 22:55:47 +03:00 committed by GitHub
parent e4c512e33d
commit 121e8678b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View file

@ -79,7 +79,7 @@ dependencies = [
[[package]]
name = "ansi_rs"
version = "0.1.0"
source = "git+https://gitlab.com/zhiburt/ansi_rs#f45b8378e5ac7bafc0ca2d2748505fe92e2af6d6"
source = "git+https://gitlab.com/zhiburt/ansi_rs#16173ad4a2812a2b0dc9faf1552d5985db4ee310"
dependencies = [
"nom 7.1.1",
]

View file

@ -22,10 +22,10 @@ const INDEX_COLUMN_NAME: &str = "index";
fn get_width_param(width_param: Option<i64>) -> usize {
if let Some(col) = width_param {
col as usize
} else if let Some((Width(w), Height(_h))) = terminal_size::terminal_size() {
(w - 1) as usize
} else if let Some((Width(w), Height(_))) = terminal_size::terminal_size() {
w as usize
} else {
80usize
80
}
}