diff options
author | Karel Zak | 2015-12-07 15:10:23 +0100 |
---|---|---|
committer | Karel Zak | 2015-12-07 15:10:23 +0100 |
commit | 96561604e2f87f94d0db633b70db463fed83cf58 (patch) | |
tree | f887f471eb2a8d76e9e8718e245acd5359cbbd2a /libsmartcols/src/table_print.c | |
parent | cfdisk: use new libsmartcols functionality to fix output (diff) | |
download | kernel-qcow2-util-linux-96561604e2f87f94d0db633b70db463fed83cf58.tar.gz kernel-qcow2-util-linux-96561604e2f87f94d0db633b70db463fed83cf58.tar.xz kernel-qcow2-util-linux-96561604e2f87f94d0db633b70db463fed83cf58.zip |
libsmartcols: fix right-aligned logic for last column
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table_print.c')
-rw-r--r-- | libsmartcols/src/table_print.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c index 91234b16a..d275ad640 100644 --- a/libsmartcols/src/table_print.c +++ b/libsmartcols/src/table_print.c @@ -324,7 +324,10 @@ static int print_data(struct libscols_table *tb, width = cl->width; bytes = strlen(data); - if (is_last_column(tb, cl) && len < width && !scols_table_is_maxout(tb)) + if (is_last_column(tb, cl) + && len < width + && !scols_table_is_maxout(tb) + && !scols_column_is_right(cl)) width = len; /* truncate data */ @@ -340,7 +343,6 @@ static int print_data(struct libscols_table *tb, if (data) { if (scols_column_is_right(cl)) { - size_t xw = cl->width; if (color) fputs(color, tb->out); for (i = len; i < width; i++) @@ -348,8 +350,7 @@ static int print_data(struct libscols_table *tb, fputs(data, tb->out); if (color) fputs(UL_COLOR_RESET, tb->out); - if (len < xw) - len = xw; + len = width; } else if (color) { char *p = data; size_t art = buffer_get_safe_art_size(buf); |