From d9a0a27a13347bd4c677b0ff1a20b7971773eb9b Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Thu, 24 Apr 2025 18:23:38 +0300 Subject: [PATCH 1/2] Bump tabled Fix cargo fmt Up --- Cargo.lock | 62 ++++-- Cargo.toml | 2 +- crates/nu-command/src/debug/inspect_table.rs | 65 +++---- crates/nu-command/tests/commands/table.rs | 191 +++++++++---------- crates/nu-table/src/table.rs | 78 +++----- crates/nu-table/src/types/expanded.rs | 7 +- crates/nu-table/src/types/general.rs | 13 +- crates/nu-table/tests/constrains.rs | 6 +- 8 files changed, 215 insertions(+), 209 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4b2a19d63..0957fa9857 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,7 +102,16 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cf4578926a981ab0ca955dc023541d19de37112bc24c1a197bd806d3d86ad1d" dependencies = [ - "ansitok", + "ansitok 0.2.0", +] + +[[package]] +name = "ansi-str" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "060de1453b69f46304b28274f382132f4e72c55637cf362920926a70d090890d" +dependencies = [ + "ansitok 0.3.0", ] [[package]] @@ -115,6 +124,16 @@ dependencies = [ "vte 0.10.1", ] +[[package]] +name = "ansitok" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0a8acea8c2f1c60f0a92a8cd26bf96ca97db56f10bbcab238bbe0cceba659ee" +dependencies = [ + "nom 7.1.3", + "vte 0.14.1", +] + [[package]] name = "anstream" version = "0.6.18" @@ -3772,7 +3791,7 @@ dependencies = [ name = "nu-explore" version = "0.103.1" dependencies = [ - "ansi-str", + "ansi-str 0.8.0", "anyhow", "crossterm", "log", @@ -4590,14 +4609,14 @@ checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" [[package]] name = "papergrid" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b0f8def1f117e13c895f3eda65a7b5650688da29d6ad04635f61bc7b92eebd" +checksum = "30268a8d20c2c0d126b2b6610ab405f16517f6ba9f244d8c59ac2c512a8a1ce7" dependencies = [ - "ansi-str", - "ansitok", + "ahash", + "ansi-str 0.9.0", + "ansitok 0.3.0", "bytecount", - "fnv", "unicode-width 0.2.0", ] @@ -7041,13 +7060,14 @@ dependencies = [ [[package]] name = "tabled" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6709222f3973137427ce50559cd564dc187a95b9cfe01613d2f4e93610e510a" +checksum = "228d124371171cd39f0f454b58f73ddebeeef3cef3207a82ffea1c29465aea43" dependencies = [ - "ansi-str", - "ansitok", + "ansi-str 0.9.0", + "ansitok 0.3.0", "papergrid", + "testing_table", ] [[package]] @@ -7121,6 +7141,16 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +[[package]] +name = "testing_table" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f8daae29995a24f65619e19d8d31dea5b389f3d853d8bf297bbf607cd0014cc" +dependencies = [ + "ansitok 0.3.0", + "unicode-width 0.2.0", +] + [[package]] name = "textwrap" version = "0.16.1" @@ -7886,6 +7916,16 @@ dependencies = [ "vte_generate_state_changes", ] +[[package]] +name = "vte" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" +dependencies = [ + "arrayvec 0.7.6", + "memchr", +] + [[package]] name = "vte_generate_state_changes" version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index 63add4922b..53ddb9e2c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,7 +159,7 @@ strum = "0.26" strum_macros = "0.26" syn = "2.0" sysinfo = "0.33" -tabled = { version = "0.17.0", default-features = false } +tabled = { version = "0.19", default-features = false } tempfile = "3.15" titlecase = "3.5" toml = "0.8" diff --git a/crates/nu-command/src/debug/inspect_table.rs b/crates/nu-command/src/debug/inspect_table.rs index 6bd5a3cce8..c0d301026c 100644 --- a/crates/nu-command/src/debug/inspect_table.rs +++ b/crates/nu-command/src/debug/inspect_table.rs @@ -1,13 +1,14 @@ // note: Seems like could be simplified // IMHO: it shall not take 300+ lines :) +// TODO: simplify -use self::{global_horizontal_char::SetHorizontalChar, set_widths::SetWidths}; +use self::global_horizontal_char::SetHorizontalChar; use nu_protocol::engine::EngineState; use nu_protocol::Value; use nu_table::{string_width, string_wrap}; use tabled::{ grid::config::ColoredConfig, - settings::{peaker::Priority, width::Wrap, Settings, Style}, + settings::{peaker::Priority, width::Wrap, Style}, Table, }; @@ -60,13 +61,12 @@ pub fn build_table( desc_table.with(Style::rounded().remove_bottom().remove_horizontals()); let mut val_table = Table::from_iter(data); - val_table.with( - Settings::default() - .with(Style::rounded().corner_top_left('├').corner_top_right('┤')) - .with(SetWidths(widths)) - .with(Wrap::new(width).priority(Priority::max(true))) - .with(SetHorizontalChar::new('┼', '┴', 11 + 2 + 1)), - ); + val_table.with(Style::rounded().corner_top_left('├').corner_top_right('┤')); + val_table.get_dimension_mut().set_widths(widths); + val_table.with(( + Wrap::new(width).priority(Priority::max(true)), + SetHorizontalChar::new('┼', '┴', 11 + 2 + 1), + )); format!("{desc_table}\n{val_table}") } @@ -315,8 +315,8 @@ mod util { mod global_horizontal_char { use tabled::{ grid::{ - config::{ColoredConfig, Offset}, - dimension::{CompleteDimensionVecRecords, Dimension}, + config::{ColoredConfig, Offset, Position}, + dimension::{CompleteDimension, Dimension}, records::{ExactRecords, Records}, }, settings::TableOption, @@ -338,14 +338,14 @@ mod global_horizontal_char { } } - impl TableOption> + impl TableOption> for SetHorizontalChar { fn change( self, records: &mut R, cfg: &mut ColoredConfig, - dimension: &mut CompleteDimensionVecRecords<'_>, + dimension: &mut CompleteDimension<'_>, ) { let count_columns = records.count_columns(); let count_rows = records.count_rows(); @@ -358,17 +358,21 @@ mod global_horizontal_char { let has_vertical = cfg.has_vertical(0, count_columns); if has_vertical && self.index == 0 { - let mut border = cfg.get_border((0, 0), (count_rows, count_columns)); + let mut border = cfg.get_border(Position::new(0, 0), (count_rows, count_columns)); border.left_top_corner = Some(self.intersection); - cfg.set_border((0, 0), border); + cfg.set_border(Position::new(0, 0), border); return; } let mut i = 1; for (col, width) in widths.into_iter().enumerate() { if self.index < i + width { - let o = self.index - i; - cfg.set_horizontal_char((0, col), self.split, Offset::Begin(o)); + let offset = self.index - i; + cfg.set_horizontal_char( + Position::new(0, col), + Offset::Start(offset), + self.split, + ); return; } @@ -377,9 +381,10 @@ mod global_horizontal_char { let has_vertical = cfg.has_vertical(col, count_columns); if has_vertical { if self.index == i { - let mut border = cfg.get_border((0, col), (count_rows, count_columns)); + let mut border = + cfg.get_border(Position::new(0, col), (count_rows, count_columns)); border.right_top_corner = Some(self.intersection); - cfg.set_border((0, col), border); + cfg.set_border(Position::new(0, col), border); return; } @@ -389,7 +394,7 @@ mod global_horizontal_char { } } - fn get_widths(dims: &CompleteDimensionVecRecords<'_>, count_columns: usize) -> Vec { + fn get_widths(dims: &CompleteDimension<'_>, count_columns: usize) -> Vec { let mut widths = vec![0; count_columns]; for (col, width) in widths.iter_mut().enumerate() { *width = dims.get_width(col); @@ -398,23 +403,3 @@ mod global_horizontal_char { widths } } - -mod set_widths { - use tabled::{ - grid::{config::ColoredConfig, dimension::CompleteDimensionVecRecords}, - settings::TableOption, - }; - - pub struct SetWidths(pub Vec); - - impl TableOption> for SetWidths { - fn change( - self, - _: &mut R, - _: &mut ColoredConfig, - dims: &mut CompleteDimensionVecRecords<'_>, - ) { - dims.set_widths(self.0); - } - } -} diff --git a/crates/nu-command/tests/commands/table.rs b/crates/nu-command/tests/commands/table.rs index 6bd7dfbc00..19650a4f9f 100644 --- a/crates/nu-command/tests/commands/table.rs +++ b/crates/nu-command/tests/commands/table.rs @@ -665,13 +665,15 @@ fn test_expand_big_0() { "open sample.toml | table --width=80 --expand" )); + _print_lines(&actual.out, 80); + let expected = join_lines([ "╭──────────────────┬───────────────────────────────────────────────────────────╮", "│ │ ╭───────────────┬───────────────────────────────────────╮ │", - "│ package │ │ │ ╭───┬───────────────────────────────╮ │ │", - "│ │ │ authors │ │ 0 │ The Nushell Project │ │ │", - "│ │ │ │ │ │ Developers │ │ │", - "│ │ │ │ ╰───┴───────────────────────────────╯ │ │", + "│ package │ │ │ ╭───┬──────────────────────╮ │ │", + "│ │ │ authors │ │ 0 │ The Nushell Project │ │ │", + "│ │ │ │ │ │ Developers │ │ │", + "│ │ │ │ ╰───┴──────────────────────╯ │ │", "│ │ │ default-run │ nu │ │", "│ │ │ description │ A new type of shell │ │", "│ │ │ documentation │ https://www.nushell.sh/book/ │ │", @@ -688,21 +690,21 @@ fn test_expand_big_0() { "│ │ │ │ ╭──────────┬────────────────────────╮ │ │", "│ │ │ metadata │ │ │ ╭───────────┬────────╮ │ │ │", "│ │ │ │ │ binstall │ │ pkg-url │ { repo │ │ │ │", - "│ │ │ │ │ │ │ │ }/rel │ │ │ │", - "│ │ │ │ │ │ │ │ eases/ │ │ │ │", - "│ │ │ │ │ │ │ │ downlo │ │ │ │", - "│ │ │ │ │ │ │ │ ad/{ v │ │ │ │", - "│ │ │ │ │ │ │ │ ersion │ │ │ │", - "│ │ │ │ │ │ │ │ }/{ │ │ │ │", + "│ │ │ │ │ │ │ │ }/rele │ │ │ │", + "│ │ │ │ │ │ │ │ ases/d │ │ │ │", + "│ │ │ │ │ │ │ │ ownloa │ │ │ │", + "│ │ │ │ │ │ │ │ d/{ ve │ │ │ │", + "│ │ │ │ │ │ │ │ rsion │ │ │ │", + "│ │ │ │ │ │ │ │ }/{ │ │ │ │", "│ │ │ │ │ │ │ │ name │ │ │ │", "│ │ │ │ │ │ │ │ }-{ ve │ │ │ │", "│ │ │ │ │ │ │ │ rsion │ │ │ │", "│ │ │ │ │ │ │ │ }-{ │ │ │ │", "│ │ │ │ │ │ │ │ target │ │ │ │", - "│ │ │ │ │ │ │ │ }.{ a │ │ │ │", - "│ │ │ │ │ │ │ │ rchive │ │ │ │", - "│ │ │ │ │ │ │ │ -forma │ │ │ │", - "│ │ │ │ │ │ │ │ t } │ │ │ │", + "│ │ │ │ │ │ │ │ }.{ ar │ │ │ │", + "│ │ │ │ │ │ │ │ chive- │ │ │ │", + "│ │ │ │ │ │ │ │ format │ │ │ │", + "│ │ │ │ │ │ │ │ } │ │ │ │", "│ │ │ │ │ │ │ pkg-fmt │ tgz │ │ │ │", "│ │ │ │ │ │ │ overrides │ {recor │ │ │ │", "│ │ │ │ │ │ │ │ d 1 │ │ │ │", @@ -856,6 +858,8 @@ fn test_expand_big_0() { "open sample.toml | table --expand --width=120" )); + _print_lines(&actual.out, 120); + let expected = join_lines([ "╭──────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────╮", "│ │ ╭───────────────┬───────────────────────────────────────────────────────────────────────────────╮ │", @@ -948,7 +952,7 @@ fn test_expand_big_0() { "│ │ │ │ │ dependencies │ │ │ ╭──────────┬─────────╮ │ │ │ │", "│ │ │ │ │ │ │ openssl │ │ version │ 0.10.38 │ │ │ │ │", "│ │ │ │ │ │ │ │ │ features │ [list 1 │ │ │ │ │", - "│ │ │ │ │ │ │ │ │ │ item] │ │ │ │ │", + "│ │ │ │ │ │ │ │ │ │ item] │ │ │ │ │", "│ │ │ │ │ │ │ │ │ optional │ true │ │ │ │ │", "│ │ │ │ │ │ │ │ ╰──────────┴─────────╯ │ │ │ │", "│ │ │ │ │ │ │ signal-hook │ {record 2 fields} │ │ │ │", @@ -1185,19 +1189,19 @@ fn test_expand_big_0() { "│ │ │ time │ 0.3.12 │ │", "│ │ ╰───────────────┴───────────────────╯ │", "│ target │ {record 3 fields} │", - "│ │ ╭───────────────────┬───────────────╮ │", - "│ dev-dependencies │ │ nu-test-support │ {record 2 │ │", - "│ │ │ │ fields} │ │", - "│ │ │ tempfile │ 3.2.0 │ │", - "│ │ │ assert_cmd │ 2.0.2 │ │", - "│ │ │ criterion │ 0.4 │ │", - "│ │ │ pretty_assertions │ 1.0.0 │ │", - "│ │ │ serial_test │ 0.10.0 │ │", - "│ │ │ hamcrest2 │ 0.3.0 │ │", - "│ │ │ rstest │ {record 2 │ │", - "│ │ │ │ fields} │ │", - "│ │ │ itertools │ 0.10.3 │ │", - "│ │ ╰───────────────────┴───────────────╯ │", + "│ │ ╭─────────────────────┬─────────────╮ │", + "│ dev-dependencies │ │ nu-test-support │ {record 2 │ │", + "│ │ │ │ fields} │ │", + "│ │ │ tempfile │ 3.2.0 │ │", + "│ │ │ assert_cmd │ 2.0.2 │ │", + "│ │ │ criterion │ 0.4 │ │", + "│ │ │ pretty_assertions │ 1.0.0 │ │", + "│ │ │ serial_test │ 0.10.0 │ │", + "│ │ │ hamcrest2 │ 0.3.0 │ │", + "│ │ │ rstest │ {record 2 │ │", + "│ │ │ │ fields} │ │", + "│ │ │ itertools │ 0.10.3 │ │", + "│ │ ╰─────────────────────┴─────────────╯ │", "│ │ ╭─────────────────────┬─────────────╮ │", "│ features │ │ │ ╭───┬─────╮ │ │", "│ │ │ plugin │ │ 0 │ nu- │ │ │", @@ -1667,75 +1671,72 @@ fn table_expande_with_no_header_internally_0() { "│ │ │ │ │ 0 │ completion_menu │ none │ tab │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ ld} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ │ 1 │ completion_previous │ shift │ backtab │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ ld} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ │ 2 │ history_menu │ control │ char_r │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ } │ │ │", "│ │ │ │ │ 3 │ next_page │ control │ char_x │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 4 │ undo_or_previous_page │ control │ char_z │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 5 │ yank │ control │ char_y │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 6 │ unix-line-discard │ control │ char_u │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ ld} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ │ 7 │ kill-line │ control │ char_k │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ ld} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ │ 8 │ commands_menu │ control │ char_t │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ │ 9 │ vars_menu │ alt │ char_o │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ │ 10 │ commands_with_description │ control │ char_s │ ╭───┬───────╮ │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ 0 │ emacs │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ 1 │ vi_no │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ │ sert │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ rmal │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ 2 │ vi_in │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ │ sert │ │ } │ │ │", "│ │ │ │ │ │ │ │ │ ╰───┴───────╯ │ │ │ │", "│ │ │ │ ╰────┴───────────────────────────┴──────────┴─────────┴───────────────┴─────╯ │ │", "│ │ ╰──────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────╯ │", @@ -1936,69 +1937,62 @@ fn table_expande_with_no_header_internally_1() { "│ │ │ │ │ 0 │ completion_menu │ none │ tab │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 1 │ completion_previous │ shift │ backtab │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 2 │ history_menu │ control │ char_r │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ } │ │ │", "│ │ │ │ │ 3 │ next_page │ control │ char_x │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 4 │ undo_or_previous_page │ control │ char_z │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 5 │ yank │ control │ char_y │ emacs │ {re │ │ │", "│ │ │ │ │ │ │ │ │ │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 6 │ unix-line-discard │ control │ char_u │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 7 │ kill-line │ control │ char_k │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 1 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ } │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ ld} │ │ │", "│ │ │ │ │ 8 │ commands_menu │ control │ char_t │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ } │ │ │", "│ │ │ │ │ 9 │ vars_menu │ alt │ char_o │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ } │ │ │", "│ │ │ │ │ 10 │ commands_with_description │ control │ char_s │ [list 3 │ {re │ │ │", "│ │ │ │ │ │ │ │ │ items] │ cor │ │ │", "│ │ │ │ │ │ │ │ │ │ d 2 │ │ │", - "│ │ │ │ │ │ │ │ │ │ fi │ │ │", - "│ │ │ │ │ │ │ │ │ │ eld │ │ │", - "│ │ │ │ │ │ │ │ │ │ s} │ │ │", + "│ │ │ │ │ │ │ │ │ │ fie │ │ │", + "│ │ │ │ │ │ │ │ │ │ lds │ │ │", + "│ │ │ │ │ │ │ │ │ │ } │ │ │", "│ │ │ │ ╰────┴───────────────────────────┴──────────┴─────────┴──────────┴─────╯ │ │", "│ │ ╰──────────────────────────────────┴──────────────────────────────────────────────────────────────────────────╯ │", "╰────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯", @@ -2168,11 +2162,10 @@ fn test_collapse_big_0() { "│ ├───────────────┼──────────┬───────────┬────────────────────┤", "│ │ metadata │ binstall │ pkg-url │ { repo }/releases/ │", "│ │ │ │ │ download/{ v │", - "│ │ │ │ │ ersion │", - "│ │ │ │ │ }/{ name }-{ vers │", - "│ │ │ │ │ ion }- │", - "│ │ │ │ │ { target }.{ │", - "│ │ │ │ │ archive-format } │", + "│ │ │ │ │ ersion }/{ name }- │", + "│ │ │ │ │ { version }- │", + "│ │ │ │ │ { target }.{ archi │", + "│ │ │ │ │ ve-format } │", "│ │ │ ├───────────┼────────────────────┤", "│ │ │ │ pkg-fmt │ tgz │", "│ │ │ ├───────────┼────────────────────┤", diff --git a/crates/nu-table/src/table.rs b/crates/nu-table/src/table.rs index e37c2180c4..8cc4291cfa 100644 --- a/crates/nu-table/src/table.rs +++ b/crates/nu-table/src/table.rs @@ -16,7 +16,7 @@ use tabled::{ config::{ AlignmentHorizontal, ColoredConfig, Entity, Indent, Position, Sides, SpannedConfig, }, - dimension::{CompleteDimensionVecRecords, SpannedGridDimension}, + dimension::{CompleteDimension, Dimension, PeekableGridDimension}, records::{ vec_records::{Text, VecRecords}, ExactRecords, Records, @@ -85,7 +85,7 @@ impl NuTable { } pub fn insert(&mut self, pos: Position, text: String) { - self.data[pos.0][pos.1] = Text::new(text); + self.data[pos.row][pos.col] = Text::new(text); } pub fn insert_row(&mut self, index: usize, row: Vec) { @@ -331,8 +331,8 @@ fn remove_header(t: &mut NuTable) -> HeadInfo { .alignments .cells .drain() - .filter(|(k, _)| k.0 != 0) - .map(|(k, v)| ((k.0 - 1, k.1), v)) + .filter(|(k, _)| k.row != 0) + .map(|(k, v)| (k - (1, 0), v)) .collect(); t.alignments.header = AlignmentHorizontal::Center; @@ -341,8 +341,8 @@ fn remove_header(t: &mut NuTable) -> HeadInfo { .styles .cells .drain() - .filter(|(k, _)| k.0 != 0) - .map(|(k, v)| ((k.0 - 1, k.1), v)) + .filter(|(k, _)| k.row != 0) + .map(|(k, v)| (k - (1, 0), v)) .collect(); t.styles.header = Color::empty(); @@ -475,12 +475,12 @@ impl WidthEstimation { } } -impl TableOption> for WidthCtrl { +impl TableOption> for WidthCtrl { fn change( self, recs: &mut NuRecords, cfg: &mut ColoredConfig, - dims: &mut CompleteDimensionVecRecords<'_>, + dims: &mut CompleteDimension<'_>, ) { if self.width.truncate { width_ctrl_truncate(self, recs, cfg, dims); @@ -501,7 +501,7 @@ fn width_ctrl_expand( ctrl: WidthCtrl, recs: &mut NuRecords, cfg: &mut ColoredConfig, - dims: &mut CompleteDimensionVecRecords, + dims: &mut CompleteDimension, ) { let opt = Width::increase(ctrl.max_width); TableOption::, _, _>::change(opt, recs, cfg, dims); @@ -511,7 +511,7 @@ fn width_ctrl_truncate( ctrl: WidthCtrl, recs: &mut NuRecords, cfg: &mut ColoredConfig, - dims: &mut CompleteDimensionVecRecords, + dims: &mut CompleteDimension, ) { for (col, (&width, width_original)) in ctrl .width @@ -547,6 +547,7 @@ fn width_ctrl_truncate( } fn align_table(table: &mut Table, alignments: Alignments, structure: &TableStructure) { + // note: IDK why it was originally here. Is it desirable? I maybe PerCell better? table.with(AlignmentStrategy::PerLine); table.with(Alignment::from(alignments.data)); @@ -559,9 +560,11 @@ fn align_table(table: &mut Table, alignments: Alignments, structure: &TableStruc } if structure.with_header { + table.modify(Rows::first(), AlignmentStrategy::PerCell); table.modify(Rows::first(), Alignment::from(alignments.header)); if structure.with_footer { + table.modify(Rows::last(), AlignmentStrategy::PerCell); table.modify(Rows::last(), Alignment::from(alignments.header)); } } @@ -965,8 +968,8 @@ fn convert_alignment(alignment: nu_color_config::Alignment) -> AlignmentHorizont // TODO: expose it get_dims_mut() struct SetDimensions(Vec); -impl TableOption> for SetDimensions { - fn change(self, _: &mut R, _: &mut ColoredConfig, dims: &mut CompleteDimensionVecRecords<'_>) { +impl TableOption> for SetDimensions { + fn change(self, _: &mut R, _: &mut ColoredConfig, dims: &mut CompleteDimension<'_>) { dims.set_widths(self.0); } } @@ -981,7 +984,7 @@ fn build_width(records: &NuRecords, pad: usize) -> Vec { cfg.set_padding(Entity::Global, padding); - SpannedGridDimension::width(records, &cfg) + PeekableGridDimension::width(records, &cfg) } // It's laverages a use of guuaranted cached widths before hand @@ -998,32 +1001,27 @@ impl SetLineHeaders { } } -impl TableOption> for SetLineHeaders { +impl TableOption> for SetLineHeaders { fn change( self, recs: &mut NuRecords, cfg: &mut ColoredConfig, - dims: &mut CompleteDimensionVecRecords<'_>, + dims: &mut CompleteDimension<'_>, ) { - let widths = match dims.get_widths() { - Some(widths) => widths, - None => { - // we don't have widths cached; which means that NO width adjustments were done - // which means we are OK to leave columns as they are. - // - // but we actually always have to have widths at this point + if dims.is_empty() { + // we don't have widths cached; which means that NO width adjustments were done + // which means we are OK to leave columns as they are. + // + // but we actually always have to have widths at this point + unreachable!("must never be the case"); + } - unreachable!("must never be the case"); - } - }; - - let columns: Vec<_> = self - .head - .values - .into_iter() - .zip(widths.iter().cloned()) // it must be always safe to do - .map(|(s, width)| Truncate::truncate(&s, width - self.pad).into_owned()) - .collect(); + let mut columns = self.head.values; + for (i, name) in columns.iter_mut().enumerate() { + let width = dims.get_width(i); + let width = width - self.pad; + *name = Truncate::truncate(name, width).into_owned(); + } let mut names = ColumnNames::new(columns) .line(self.line) @@ -1045,17 +1043,3 @@ fn theme_copy_horizontal_line(theme: &mut tabled::settings::Theme, from: usize, theme.insert_horizontal_line(to, *line); } } - -// todo: create a method -#[derive(Debug, Default)] -struct GetDims(Vec); - -impl TableOption> for &mut GetDims { - fn change(self, _: &mut R, _: &mut C, dims: &mut CompleteDimensionVecRecords<'_>) { - self.0 = dims.get_widths().expect("expected to get it").to_vec(); - } - - fn hint_change(&self) -> Option { - None - } -} diff --git a/crates/nu-table/src/types/expanded.rs b/crates/nu-table/src/types/expanded.rs index c93832fc19..00d6573003 100644 --- a/crates/nu-table/src/types/expanded.rs +++ b/crates/nu-table/src/types/expanded.rs @@ -201,7 +201,7 @@ fn expand_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { let value = NuRecordsValue::new(cell.text); data[row].push(value); - data_styles.insert((row, with_index as usize), cell.style); + data_styles.insert(Position::new(row, with_index as usize), cell.style); rows_count = rows_count.saturating_add(cell.size); } @@ -288,7 +288,10 @@ fn expand_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { let value = NuRecordsValue::new(cell.text); data[row + 1].push(value); - data_styles.insert((row + 1, col + with_index as usize), cell.style); + data_styles.insert( + Position::new(row + 1, col + with_index as usize), + cell.style, + ); column_rows = column_rows.saturating_add(cell.size); } diff --git a/crates/nu-table/src/types/general.rs b/crates/nu-table/src/types/general.rs index 81d4906783..b702231857 100644 --- a/crates/nu-table/src/types/general.rs +++ b/crates/nu-table/src/types/general.rs @@ -1,6 +1,7 @@ use nu_color_config::TextStyle; use nu_engine::column::get_columns; use nu_protocol::{Config, Record, ShellError, Value}; +use tabled::grid::config::Position; use crate::{ clean_charset, colorize_space, @@ -111,7 +112,7 @@ fn create_table_with_header( for (col, header) in headers.iter().enumerate() { let (text, style) = get_string_value_with_header(item, header.as_ref(), opts); - let pos = (row + 1, col); + let pos = Position::new(row + 1, col); table.insert(pos, text); table.insert_style(pos, style); } @@ -142,12 +143,12 @@ fn create_table_with_header_and_index( check_value(item)?; let text = get_table_row_index(item, opts.config, row, row_offset); - table.insert((row + 1, 0), text); + table.insert(Position::new(row + 1, 0), text); for (col, header) in headers.iter().enumerate().skip(1) { let (text, style) = get_string_value_with_header(item, header.as_ref(), opts); - let pos = (row + 1, col); + let pos = Position::new(row + 1, col); table.insert(pos, text); table.insert_style(pos, style); } @@ -169,7 +170,7 @@ fn create_table_with_no_header( let (text, style) = get_string_value(item, opts); - let pos = (row, 0); + let pos = Position::new(row, 0); table.insert(pos, text); table.insert_style(pos, style); } @@ -190,11 +191,11 @@ fn create_table_with_no_header_and_index( check_value(item)?; let text = get_table_row_index(item, opts.config, row, row_offset); - table.insert((row, 0), text); + table.insert(Position::new(row, 0), text); let (text, style) = get_string_value(item, opts); - let pos = (row, 1); + let pos = Position::new(row, 1); table.insert(pos, text); table.insert_style(pos, style); } diff --git a/crates/nu-table/tests/constrains.rs b/crates/nu-table/tests/constrains.rs index c0c057acfd..e8c5ed243c 100644 --- a/crates/nu-table/tests/constrains.rs +++ b/crates/nu-table/tests/constrains.rs @@ -81,8 +81,8 @@ fn wrap_test() { let tests = [ (15, Some("┏━━━━━━━┳━━━━━┓\n┃ 123 4 ┃ ... ┃\n┃ 5678 ┃ ┃\n┣━━━━━━━╋━━━━━┫\n┃ 0 ┃ ... ┃\n┃ 0 ┃ ... ┃\n┗━━━━━━━┻━━━━━┛")), (21, Some("┏━━━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ ... ┃\n┣━━━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ ... ┃\n┃ 0 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━┛")), - (29, Some("┏━━━━━━━━━━━┳━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw e ┃ ... ┃\n┃ ┃ qwe ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ ... ┃\n┃ 0 ┃ 1 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━┻━━━━━┛")), - (49, Some("┏━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw eqwe ┃ xxx xx xx x xx ┃ ... ┃\n┃ ┃ ┃ x xx xx ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━┛")), + (29, Some("┏━━━━━━━━━━━┳━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw e ┃ ... ┃\n┃ ┃ qwe ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ ... ┃\n┃ 0 ┃ 1 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━┻━━━━━┛")), + (49, Some("┏━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw eqwe ┃ xxx xx xx x xx ┃ ... ┃\n┃ ┃ ┃ x xx xx ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━┛")), ]; test_trim(&tests, TrimStrategy::wrap(false)); @@ -98,7 +98,7 @@ fn wrap_keep_words_test() { (15, Some("┏━━━━━━━┳━━━━━┓\n┃ 123 ┃ ... ┃\n┃ 45678 ┃ ┃\n┣━━━━━━━╋━━━━━┫\n┃ 0 ┃ ... ┃\n┃ 0 ┃ ... ┃\n┗━━━━━━━┻━━━━━┛")), (21, Some("┏━━━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ ... ┃\n┣━━━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ ... ┃\n┃ 0 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━┛")), (29, Some("┏━━━━━━━━━━━┳━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw ┃ ... ┃\n┃ ┃ eqwe ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ ... ┃\n┃ 0 ┃ 1 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━┻━━━━━┛")), - (49, Some("┏━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw eqwe ┃ xxx xx xx x xx ┃ ... ┃\n┃ ┃ ┃ x xx xx ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━┛")), + (49, Some("┏━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━┓\n┃ 123 45678 ┃ qweqw eqwe ┃ xxx xx xx x xx ┃ ... ┃\n┃ ┃ ┃ x xx xx ┃ ┃\n┣━━━━━━━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━╋━━━━━┫\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┃ 0 ┃ 1 ┃ 2 ┃ ... ┃\n┗━━━━━━━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━┻━━━━━┛")), ]; test_trim(&tests, TrimStrategy::wrap(true)); From f75283308b81f677f403d8359ecf45f4efd23c05 Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Fri, 25 Apr 2025 16:04:43 +0300 Subject: [PATCH 2/2] up --- Cargo.lock | 7 +++---- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0957fa9857..336fcb9f9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,6 +30,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "const-random", "getrandom 0.2.15", "once_cell", "version_check", @@ -4610,8 +4611,7 @@ checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" [[package]] name = "papergrid" version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30268a8d20c2c0d126b2b6610ab405f16517f6ba9f244d8c59ac2c512a8a1ce7" +source = "git+https://github.com/zhiburt/tabled?rev=fd48cef72a3e87beada497689509f9ab7b5823dd#fd48cef72a3e87beada497689509f9ab7b5823dd" dependencies = [ "ahash", "ansi-str 0.9.0", @@ -7061,8 +7061,7 @@ dependencies = [ [[package]] name = "tabled" version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "228d124371171cd39f0f454b58f73ddebeeef3cef3207a82ffea1c29465aea43" +source = "git+https://github.com/zhiburt/tabled?rev=fd48cef72a3e87beada497689509f9ab7b5823dd#fd48cef72a3e87beada497689509f9ab7b5823dd" dependencies = [ "ansi-str 0.9.0", "ansitok 0.3.0", diff --git a/Cargo.toml b/Cargo.toml index 53ddb9e2c8..274e3c5273 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,7 +159,7 @@ strum = "0.26" strum_macros = "0.26" syn = "2.0" sysinfo = "0.33" -tabled = { version = "0.19", default-features = false } +tabled = { git = "https://github.com/zhiburt/tabled", rev = "fd48cef72a3e87beada497689509f9ab7b5823dd", default-features = false } tempfile = "3.15" titlecase = "3.5" toml = "0.8"