diff options
author | Karel Zak | 2011-07-15 15:35:48 +0200 |
---|---|---|
committer | Karel Zak | 2011-07-15 15:35:48 +0200 |
commit | 24563aea022cf94d1589c22f694f636a8dd2078d (patch) | |
tree | 349ce520c5a84a18d411e24bcf7cce84af39a9cc /lib | |
parent | lsblk: add state attribute (diff) | |
download | kernel-qcow2-util-linux-24563aea022cf94d1589c22f694f636a8dd2078d.tar.gz kernel-qcow2-util-linux-24563aea022cf94d1589c22f694f636a8dd2078d.tar.xz kernel-qcow2-util-linux-24563aea022cf94d1589c22f694f636a8dd2078d.zip |
include: [tt.c] always truncate if TT_FL_TRUNC
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tt.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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--; } |