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 <kzak@redhat.com>
This commit is contained in:
Karel Zak 2018-02-15 11:58:41 +01:00
parent 19b10b8978
commit 0f9f927b6f
1 changed files with 2 additions and 0 deletions

View File

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