From 5627fcec0e3944f431f98eb411fc1ea5a559fd3c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 27 Jul 2015 14:29:38 +0200 Subject: [PATCH] libsmartcols: reduce relative columns more aggressively Signed-off-by: Karel Zak --- libsmartcols/src/table_print.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index c743bf7bd..6cef68f76 100644 --- a/libsmartcols/src/table_print.c +++ b/libsmartcols/src/table_print.c @@ -877,12 +877,15 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf if (cl->width == cl->width_min) continue; + DBG(TAB, ul_debugobj(tb, " tring to reduce: %s (width=%zu)", cl->header.data, cl->width)); + /* truncate column with relative sizes */ if (cl->width_hint < 1 && cl->width > 0 && width > 0 && - cl->width > cl->width_hint * tb->termwidth) { + cl->width >= (size_t) (cl->width_hint * tb->termwidth)) { cl->width--; width--; } + /* truncate column with absolute size */ if (cl->width_hint > 1 && cl->width > 0 && width > 0 && !trunc_only) {