summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2018-02-15 11:58:41 +0100
committerKarel Zak2018-02-15 12:20:17 +0100
commit0f9f927b6f62cb7f488fadfad76c4a5defdefe36 (patch)
tree7502634014ac13cdf94f608b88ed380759e08f98
parentlibsmartcols: interpret zero width for pending data as error (diff)
downloadkernel-qcow2-util-linux-0f9f927b6f62cb7f488fadfad76c4a5defdefe36.tar.gz
kernel-qcow2-util-linux-0f9f927b6f62cb7f488fadfad76c4a5defdefe36.tar.xz
kernel-qcow2-util-linux-0f9f927b6f62cb7f488fadfad76c4a5defdefe36.zip
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>
-rw-r--r--libsmartcols/src/table_print.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index b0b5b6c81..5d6173299 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);