From: taiyu Date: Thu, 15 Feb 2018 06:50:36 +0000 (-0800) Subject: libsmartcols: fixes issue with 0 width columns X-Git-Tag: v2.32-rc2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f9b4f2f3a2b24e38713ad7a001be461e8fd1649;p=thirdparty%2Futil-linux.git libsmartcols: fixes issue with 0 width columns [kzak@redhat.com: - it's possible that column has zero width when minimal width is reduced due to very small terminal. In this case make sure that we do not use such column at all.] Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index 5d61732991..67e51076ea 100644 --- a/libsmartcols/src/table_print.c +++ b/libsmartcols/src/table_print.c @@ -1346,6 +1346,10 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf width--; break; } + + /* hide zero width columns */ + if (cl->width == 0) + cl->flags |= SCOLS_FL_HIDDEN; } /* the current stage is without effect, go to the next */