From 515f31eb528326c2275c08f7a0373e1529b4fb3e Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Tue, 28 Mar 2017 16:08:50 +0300 Subject: progress: shorten bar to prevent newlines on some terminals On some (probably buggy) terminals, printing up to the rightmost column may end up with the terminal issueing a newline (probably due to putting the cursor at the next char -> new line). Some other progress bars avoid it by not reaching the rightmost column. Shorten the bar width from term-width - 7 to -8 (the 7 are "xxx% []"). --- src/print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/print.c b/src/print.c index 3e2a570..5df51f3 100644 --- a/src/print.c +++ b/src/print.c @@ -64,7 +64,7 @@ void apk_print_progress(size_t done, size_t total) if (!(apk_flags & APK_PROGRESS)) return; - bar_width = apk_get_screen_width() - 7; + bar_width = apk_get_screen_width() - 8; if (total > 0) { bar = muldiv(bar_width, done, total); percent = muldiv(100, done, total); -- cgit v1.2.3-70-g09d2