nu_table: Fix truncating logic (#6028)

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
Maxim Zhiburt
2022-07-12 21:35:05 +03:00
committed by GitHub
parent 93a965e3e2
commit 8b6232ac87
3 changed files with 6 additions and 6 deletions

View File

@ -19,4 +19,4 @@ unicode-width = "0.1.8"
strip-ansi-escapes = "0.1.1"
ansi-str = { git = "https://github.com/zhiburt/ansi-str", rev = "655cd8125a032286082794690c2cc6dc835345b4" }
atty = "0.2.14"
tabled = { git = "https://github.com/zhiburt/tabled", branch = "master", features = ["color"] }
tabled = { git = "https://github.com/zhiburt/tabled", rev = "a7f05c18aa9e5edc004a984051659d0d05b6e594", features = ["color"] }

View File

@ -305,11 +305,11 @@ impl tabled::TableOption for &TrimStrategyModifier<'_> {
w.change(grid)
}
TrimStrategy::Truncate { suffix } => {
let mut w =
Width::truncate(self.termwidth).priority::<tabled::width::PriorityMax>();
let mut w = Width::truncate(self.termwidth);
if let Some(suffix) = suffix {
w = w.suffix(suffix);
}
let mut w = w.priority::<tabled::width::PriorityMax>();
w.change(grid);
}