mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 00:48:59 +02:00
Fix some issues with table wrapping of lists (#7598)
close #7591 I tend to think it must be addressed. But I'd verify it @rgwood. PS: I've noticed how `table -e` and `table` with the same width wraps a bit differently sometimes. (I guess it also must be addressed......) Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
@ -450,7 +450,7 @@ fn truncate_columns_by_content(data: &mut Data, theme: &TableTheme, termwidth: u
|
||||
}
|
||||
|
||||
// we don't need any truncation then (is it possible?)
|
||||
if truncate_pos + 1 == data.count_columns() {
|
||||
if truncate_pos == data.count_columns() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use tabled::{builder::Builder, Padding, Style, Width};
|
||||
use tabled::{builder::Builder, object::Cell, Modify, Padding, Style, Width};
|
||||
|
||||
pub fn string_width(text: &str) -> usize {
|
||||
tabled::papergrid::util::string_width_multiline_tab(text, 4)
|
||||
@ -16,9 +16,11 @@ pub fn wrap_string(text: &str, width: usize) -> String {
|
||||
|
||||
Builder::from_iter([[text]])
|
||||
.build()
|
||||
.with(Padding::zero())
|
||||
.with(Style::empty())
|
||||
.with(Width::wrap(width))
|
||||
.with(Padding::zero())
|
||||
.with(Modify::new(Cell(0, 0)).with(Width::wrap(width)))
|
||||
.to_string()
|
||||
.trim_end()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user