]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: fixes issue with 0 width columns
authortaiyu <taiyu.len@gmail.com>
Thu, 15 Feb 2018 06:50:36 +0000 (22:50 -0800)
committerKarel Zak <kzak@redhat.com>
Thu, 15 Feb 2018 11:27:23 +0000 (12:27 +0100)
[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>
libsmartcols/src/table_print.c

index 5d61732991fffc941e29775705c798bb149d9506..67e51076eac316c6cc484472a820fbf98c1d829b 100644 (file)
@@ -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 */