From 764402d8b945f7abbfa5f68a6d16c94c635f7ffe Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 14 May 2024 21:22:58 +0200 Subject: Merging upstream version 2.40.1. Signed-off-by: Daniel Baumann --- libsmartcols/src/print.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'libsmartcols/src/print.c') diff --git a/libsmartcols/src/print.c b/libsmartcols/src/print.c index 88ab5a2..ab279e3 100644 --- a/libsmartcols/src/print.c +++ b/libsmartcols/src/print.c @@ -764,11 +764,11 @@ notree: } } +done: /* reset wrapping after greatest chunk calculation */ if (cal && scols_column_is_wrap(cl)) scols_column_reset_wrap(cl); -done: DBG(COL, ul_debugobj(cl, "__cursor_to_buffer rc=%d", rc)); return rc; } @@ -802,8 +802,12 @@ static int print_line(struct libscols_table *tb, rc = __cursor_to_buffer(tb, buf, 0); if (!rc) rc = print_data(tb, buf); - if (!rc && scols_column_has_pending_wrap(cl)) - pending = 1; + if (!rc) { + if (scols_column_has_pending_wrap(cl)) + pending = 1; + else + scols_column_reset_wrap(cl); + } scols_table_reset_cursor(tb); } fputs_color_line_close(tb); @@ -827,10 +831,12 @@ static int print_line(struct libscols_table *tb, rc = __cursor_to_buffer(tb, buf, 0); if (!rc) rc = print_pending_data(tb, buf); - if (!rc && scols_column_has_pending_wrap(cl)) - pending = 1; - if (!rc && !pending) - scols_column_reset_wrap(cl); + if (!rc) { + if (scols_column_has_pending_wrap(cl)) + pending = 1; + else + scols_column_reset_wrap(cl); + } } else print_empty_cell(tb, cl, ln, NULL, ul_buffer_get_bufsiz(buf)); scols_table_reset_cursor(tb); -- cgit v1.2.3