From: Karel Zak Date: Mon, 27 Jul 2015 12:29:38 +0000 (+0200) Subject: libsmartcols: reduce relative columns more aggressively X-Git-Tag: v2.27-rc1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5627fcec0e3944f431f98eb411fc1ea5a559fd3c;p=thirdparty%2Futil-linux.git libsmartcols: reduce relative columns more aggressively Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index c743bf7bd2..6cef68f769 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) {