summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table_print.c
diff options
context:
space:
mode:
authorIgor Gnatenko2016-01-22 14:30:39 +0100
committerIgor Gnatenko2016-01-22 14:30:39 +0100
commit57c7b2a1a56a4c7c3f3534c0b7e92a91dcffe15f (patch)
treeac53ce6f533fef8e2f7052e9121b0c5910181262 /libsmartcols/src/table_print.c
parentlibsmartcols: wrap columns correctly with unicode (diff)
downloadkernel-qcow2-util-linux-57c7b2a1a56a4c7c3f3534c0b7e92a91dcffe15f.tar.gz
kernel-qcow2-util-linux-57c7b2a1a56a4c7c3f3534c0b7e92a91dcffe15f.tar.xz
kernel-qcow2-util-linux-57c7b2a1a56a4c7c3f3534c0b7e92a91dcffe15f.zip
libsmartcols: don't loose colors when wrapping
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Diffstat (limited to 'libsmartcols/src/table_print.c')
-rw-r--r--libsmartcols/src/table_print.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index b67640751..ef4e7654b 100644
--- a/libsmartcols/src/table_print.c
+++ b/libsmartcols/src/table_print.c
@@ -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);