nu-table: Fix wrap logic (#5998)

Adding space may overflow a cell_width.

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
Maxim Zhiburt 2022-07-09 22:55:39 +03:00 committed by GitHub
parent 81df42d63b
commit e4c512e33d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;