Skip to content

Commit

Permalink
Bump tabled to 0.17 (#14415)
Browse files Browse the repository at this point in the history
With this comes a new `unicode-width` as I remember there was some issue
with `ratatui`.
 
And a bit of refactorings which are ment to reduce code lines while not
breaking anything.
Not yet complete, I think I'll try to improve some more places,
just wanted to trigger CI 😄 

And yessssssssss we have a new `unicode-width` but I sort of doubtful,
I mean the original issue with emojie.
I think it may require an additional "clean" call.
I am just saying I was not testing it with that case of complex emojies.

---------

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
  • Loading branch information
zhiburt authored Dec 28, 2024
1 parent 5314b31 commit 4401924
Show file tree
Hide file tree
Showing 24 changed files with 1,407 additions and 1,370 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ sha2 = "0.10"
strip-ansi-escapes = "0.2.0"
syn = "2.0"
sysinfo = "0.32"
tabled = { version = "0.16.0", default-features = false }
tabled = { version = "0.17.0", default-features = false }
tempfile = "3.14"
terminal_size = "0.4"
titlecase = "3.0"
Expand Down
13 changes: 8 additions & 5 deletions crates/nu-command/src/debug/inspect_table.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
use crate::debug::inspect_table::{
global_horizontal_char::SetHorizontalChar, set_widths::SetWidths,
};
// note: Seems like could be simplified
// IMHO: it shall not take 300+ lines :)

use nu_protocol::Value;
use nu_table::{string_width, string_wrap};

use tabled::{
grid::config::ColoredConfig,
settings::{peaker::PriorityMax, width::Wrap, Settings, Style},
settings::{peaker::Priority, width::Wrap, Settings, Style},
Table,
};

use self::{global_horizontal_char::SetHorizontalChar, set_widths::SetWidths};

pub fn build_table(value: Value, description: String, termsize: usize) -> String {
let (head, mut data) = util::collect_input(value);
let count_columns = head.len();
Expand Down Expand Up @@ -57,7 +60,7 @@ pub fn build_table(value: Value, description: String, termsize: usize) -> String
Settings::default()
.with(Style::rounded().corner_top_left('├').corner_top_right('┤'))
.with(SetWidths(widths))
.with(Wrap::new(width).priority(PriorityMax))
.with(Wrap::new(width).priority(Priority::max(true)))
.with(SetHorizontalChar::new('┼', '┴', 11 + 2 + 1)),
);

Expand Down
Loading

0 comments on commit 4401924

Please sign in to comment.