From 24563aea022cf94d1589c22f694f636a8dd2078d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 15 Jul 2011 15:35:48 +0200 Subject: [PATCH] include: [tt.c] always truncate if TT_FL_TRUNC Signed-off-by: Karel Zak --- lib/tt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/tt.c b/lib/tt.c index 1929a48cfe..576d2b36a7 100644 --- a/lib/tt.c +++ b/lib/tt.c @@ -414,7 +414,7 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) if (width <= tb->termwidth) break; - if (cl->width_hint > 1) + if (cl->width_hint > 1 && !(cl->flags & TT_FL_TRUNC)) continue; /* never truncate columns with absolute sizes */ if (cl->flags & TT_FL_TREE) continue; /* never truncate the tree */ @@ -422,7 +422,15 @@ static void recount_widths(struct tt *tb, char *buf, size_t bufsz) continue; if (cl->width == cl->width_min) continue; - if (cl->width > cl->width_hint * tb->termwidth) { + + /* truncate column with relative sizes */ + if (cl->width_hint < 1 && + cl->width > cl->width_hint * tb->termwidth) { + cl->width--; + width--; + } + /* truncate column with absolute size */ + if (cl->width_hint > 1 && !trunc_only) { cl->width--; width--; } -- 2.47.2