diff --git a/Cargo.lock b/Cargo.lock index be8ab2e527..6b4a6c6d6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3102,11 +3102,13 @@ checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b" [[package]] name = "papergrid" -version = "0.4.0" -source = "git+https://github.com/zhiburt/tabled?rev=f24b945bdd3a1152d52561b70b0c88c2581ac5ff#f24b945bdd3a1152d52561b70b0c88c2581ac5ff" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453cf71f2a37af495a1a124bf30d4d7469cfbea58e9f2479be9d222396a518a2" dependencies = [ "ansi-str", "bytecount", + "fnv", "strip-ansi-escapes", "unicode-width", ] @@ -4720,8 +4722,9 @@ dependencies = [ [[package]] name = "tabled" -version = "0.7.0" -source = "git+https://github.com/zhiburt/tabled?rev=f24b945bdd3a1152d52561b70b0c88c2581ac5ff#f24b945bdd3a1152d52561b70b0c88c2581ac5ff" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b2f8c37d26d87d2252187b0a45ea3cbf42baca10377c7e7eaaa2800fa9bf97" dependencies = [ "ansi-str", "papergrid", @@ -4731,8 +4734,9 @@ dependencies = [ [[package]] name = "tabled_derive" -version = "0.3.0" -source = "git+https://github.com/zhiburt/tabled?rev=f24b945bdd3a1152d52561b70b0c88c2581ac5ff#f24b945bdd3a1152d52561b70b0c88c2581ac5ff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9ee618502f497abf593e1c5c9577f34775b111480009ffccd7ad70d23fcaba8" dependencies = [ "heck 0.4.0", "proc-macro-error", diff --git a/crates/nu-table/Cargo.toml b/crates/nu-table/Cargo.toml index cf34a59ec7..ca43e0fe4c 100644 --- a/crates/nu-table/Cargo.toml +++ b/crates/nu-table/Cargo.toml @@ -16,4 +16,4 @@ nu-ansi-term = "0.46.0" nu-protocol = { path = "../nu-protocol", version = "0.65.1" } strip-ansi-escapes = "0.1.1" atty = "0.2.14" -tabled = { git = "https://github.com/zhiburt/tabled", rev = "f24b945bdd3a1152d52561b70b0c88c2581ac5ff", features = ["color"] } +tabled = { version = "0.8.0", features = ["color"] } diff --git a/crates/nu-table/src/table.rs b/crates/nu-table/src/table.rs index 6c0d1a8e82..424e514722 100644 --- a/crates/nu-table/src/table.rs +++ b/crates/nu-table/src/table.rs @@ -7,7 +7,7 @@ use tabled::{ formatting_settings::AlignmentStrategy, object::{Cell, Columns, Rows, Segment}, papergrid, - style::BorderColor, + style::Color, Alignment, AlignmentHorizontal, Modify, ModifyObject, TableOption, Width, }; @@ -205,20 +205,20 @@ fn align_table( .with(AlignmentStrategy::PerLine), ); + if with_header { + let alignment = Alignment::Horizontal(alignments.header); + if with_footer { + table = table.with(Modify::new(Rows::last()).with(alignment.clone())); + } + + table = table.with(Modify::new(Rows::first()).with(alignment)); + } + if with_index { table = table.with(Modify::new(Columns::first()).with(Alignment::Horizontal(alignments.index))); } - if with_header { - let alignment = Alignment::Horizontal(alignments.header); - table = table.with(Modify::new(Rows::first()).with(alignment.clone())); - - if with_footer { - table = table.with(Modify::new(Rows::last()).with(alignment)); - } - } - table = override_alignments(table, data, with_header, with_index, alignments); table @@ -269,7 +269,7 @@ fn load_theme( if let Some(color) = color_hm.get("separator") { let color = color.paint(" ").to_string(); - if let Ok(color) = BorderColor::try_from(color) { + if let Ok(color) = Color::try_from(color) { table = table.with(color); } }