From 59271f8c1382efc6b52ac20c862ef7126317d0a8 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Fri, 2 Nov 2018 15:33:49 +0200 Subject: print: don't print spurious newlines --- src/print.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/print.c b/src/print.c index 63be863..b2bbca4 100644 --- a/src/print.c +++ b/src/print.c @@ -100,10 +100,10 @@ void apk_print_progress(size_t done, size_t total) int apk_print_indented(struct apk_indent *i, apk_blob_t blob) { - if (i->x + blob.len + 1 >= apk_get_screen_width()) - i->x = printf("\n%*s" BLOB_FMT, i->indent, "", BLOB_PRINTF(blob)) - 1; - else if (i->x <= i->indent) + if (i->x <= i->indent) i->x += printf("%*s" BLOB_FMT, i->indent - i->x, "", BLOB_PRINTF(blob)); + else if (i->x + blob.len + 1 >= apk_get_screen_width()) + i->x = printf("\n%*s" BLOB_FMT, i->indent, "", BLOB_PRINTF(blob)) - 1; else i->x += printf(" " BLOB_FMT, BLOB_PRINTF(blob)); apk_progress_force = 1; -- cgit v1.2.3-60-g2f50