From 05c1123bc3d3c4473397dcf73b2b9ef391950c3d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 7 Dec 2015 12:22:29 +0100 Subject: [PATCH] libsmartcols: don't use fprintf() when count cells fprintf("%*s") is based on bytes, no cells. Signed-off-by: Karel Zak --- libsmartcols/src/table_print.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index 24f1d5a4d..91234b16a 100644 --- a/libsmartcols/src/table_print.c +++ b/libsmartcols/src/table_print.c @@ -343,7 +343,9 @@ static int print_data(struct libscols_table *tb, size_t xw = cl->width; if (color) fputs(color, tb->out); - fprintf(tb->out, "%*s", (int) xw, data); + for (i = len; i < width; i++) + fputc(' ', tb->out); + fputs(data, tb->out); if (color) fputs(UL_COLOR_RESET, tb->out); if (len < xw)