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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

6
Cargo.lock generated
View file

@ -3187,7 +3187,7 @@ checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b"
[[package]]
name = "papergrid"
version = "0.4.0"
source = "git+https://github.com/zhiburt/tabled?branch=master#b4fbad01ac95cd4a7d71fa0bf67eba02541c7963"
source = "git+https://github.com/zhiburt/tabled?rev=a7f05c18aa9e5edc004a984051659d0d05b6e594#a7f05c18aa9e5edc004a984051659d0d05b6e594"
dependencies = [
"ansi-str 0.1.1",
"bytecount",
@ -4805,7 +4805,7 @@ dependencies = [
[[package]]
name = "tabled"
version = "0.7.0"
source = "git+https://github.com/zhiburt/tabled?branch=master#b4fbad01ac95cd4a7d71fa0bf67eba02541c7963"
source = "git+https://github.com/zhiburt/tabled?rev=a7f05c18aa9e5edc004a984051659d0d05b6e594#a7f05c18aa9e5edc004a984051659d0d05b6e594"
dependencies = [
"ansi-str 0.2.0 (git+https://github.com/zhiburt/ansi-str?branch=master)",
"papergrid",
@ -4816,7 +4816,7 @@ dependencies = [
[[package]]
name = "tabled_derive"
version = "0.3.0"
source = "git+https://github.com/zhiburt/tabled?branch=master#b4fbad01ac95cd4a7d71fa0bf67eba02541c7963"
source = "git+https://github.com/zhiburt/tabled?rev=a7f05c18aa9e5edc004a984051659d0d05b6e594#a7f05c18aa9e5edc004a984051659d0d05b6e594"
dependencies = [
"heck 0.4.0",
"proc-macro-error",

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);
}