]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: don't loose colors when wrapping
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Fri, 22 Jan 2016 13:30:39 +0000 (14:30 +0100)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Fri, 22 Jan 2016 13:30:39 +0000 (14:30 +0100)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
libsmartcols/src/table_print.c

index b676407510d87346be0b0624091b67e51a72373f..ef4e7654b6cde3a750bd14da6837fe4bf4758f13 100644 (file)
@@ -356,6 +356,9 @@ static int print_data(struct libscols_table *tb,
                        char *p = data;
                        i = 0;
 
+                       if (color)
+                               fputs(color, tb->out);
+
                        while (*p) {
                                len = width;
                                p = strdup(p);
@@ -373,6 +376,9 @@ static int print_data(struct libscols_table *tb,
                                                print_empty_cell (tb, scols_table_get_column(tb, j),
                                                                  NULL, buf->bufsz);
                        }
+
+                       if (color)
+                               fputs(UL_COLOR_RESET, tb->out);
                } else if (color) {
                        char *p = data;
                        size_t art = buffer_get_safe_art_size(buf);