From 0f9b4f2f3a2b24e38713ad7a001be461e8fd1649 Mon Sep 17 00:00:00 2001 From: taiyu Date: Wed, 14 Feb 2018 22:50:36 -0800 Subject: 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 --- libsmartcols/src/table_print.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libsmartcols') 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 */ -- cgit v1.2.3-55-g7522