mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 23:22:32 +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:
@ -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