]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: reduce relative columns more aggressively
authorKarel Zak <kzak@redhat.com>
Mon, 27 Jul 2015 12:29:38 +0000 (14:29 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 27 Jul 2015 12:29:38 +0000 (14:29 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/table_print.c

index c743bf7bd2a52522392e4b6af733ac0d4b333cd8..6cef68f769c07f127e67695fe6c17e8d61a691f2 100644 (file)
@@ -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) {