From: Karel Zak Date: Thu, 15 Feb 2018 10:58:41 +0000 (+0100) Subject: libsmartcols: set minimal column width to 1 X-Git-Tag: v2.32-rc2~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f9f927b6f62cb7f488fadfad76c4a5defdefe36;p=thirdparty%2Futil-linux.git libsmartcols: set minimal column width to 1 The default is to use header width or relative width setting as the minimal column width. The problem are columns where is no header or relative width. Let's set minimal width to 1 in this case. Addresses: https://github.com/karelzak/util-linux/pull/577 Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index b0b5b6c81f..5d61732991 100644 --- a/libsmartcols/src/table_print.c +++ b/libsmartcols/src/table_print.c @@ -1068,6 +1068,8 @@ static int count_column_width(struct libscols_table *tb, size_t len = mbs_safe_width(scols_cell_get_data(&cl->header)); cl->width_min = max(cl->width_min, len); } + if (!cl->width_min) + cl->width_min = 1; } scols_reset_iter(&itr, SCOLS_ITER_FORWARD);