summaryrefslogtreecommitdiffstats
path: root/libsmartcols
diff options
context:
space:
mode:
authortaiyu2018-02-15 07:50:36 +0100
committerKarel Zak2018-02-15 12:27:23 +0100
commit0f9b4f2f3a2b24e38713ad7a001be461e8fd1649 (patch)
tree8f540a61d27d27a0e95a0d4a30fc843664f3bbee /libsmartcols
parentlibsmartcols: set minimal column width to 1 (diff)
downloadkernel-qcow2-util-linux-0f9b4f2f3a2b24e38713ad7a001be461e8fd1649.tar.gz
kernel-qcow2-util-linux-0f9b4f2f3a2b24e38713ad7a001be461e8fd1649.tar.xz
kernel-qcow2-util-linux-0f9b4f2f3a2b24e38713ad7a001be461e8fd1649.zip
libsmartcols: fixes issue with 0 width columns
[kzak@redhat.com: - it's possible that column has zero width when minimal width is reduced due to very small terminal. In this case make sure that we do not use such column at all.] Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols')
-rw-r--r--libsmartcols/src/table_print.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index 5d6173299..67e51076e 100644
--- a/libsmartcols/src/table_print.c
+++ b/libsmartcols/src/table_print.c
@@ -1346,6 +1346,10 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
width--;
break;
}
+
+ /* hide zero width columns */
+ if (cl->width == 0)
+ cl->flags |= SCOLS_FL_HIDDEN;
}
/* the current stage is without effect, go to the next */