From e4c512e33d81e8fb0edfa56acd4f9ac12d04891b Mon Sep 17 00:00:00 2001 From: Maxim Zhiburt Date: Sat, 9 Jul 2022 22:55:39 +0300 Subject: [PATCH] nu-table: Fix wrap logic (#5998) Adding space may overflow a cell_width. Signed-off-by: Maxim Zhiburt --- crates/nu-table/src/wrap.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/nu-table/src/wrap.rs b/crates/nu-table/src/wrap.rs index 79f5759115..c581a84498 100644 --- a/crates/nu-table/src/wrap.rs +++ b/crates/nu-table/src/wrap.rs @@ -254,8 +254,12 @@ pub fn wrap_content( for subline in line.sublines { if !first { - current_line_width += 1 + subline.width; - current_line.push(' '); + current_line_width += subline.width; + + if current_line_width + 1 < cell_width { + current_line_width += 1; + current_line.push(' '); + } } else { first = false; current_line_width = subline.width;