Bump tabled to 0.17 (#14415)

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>
This commit is contained in:
Maxim Zhiburt
2024-12-28 17:19:48 +03:00
committed by GitHub
parent 5314b31b12
commit 4401924128
24 changed files with 1419 additions and 1382 deletions

View File

@ -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();
@ -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)),
);