]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: make prefix argument to clear_progress_bar() optional
authorLennart Poettering <lennart@poettering.net>
Fri, 24 May 2024 11:56:47 +0000 (13:56 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 25 Jun 2024 08:05:07 +0000 (10:05 +0200)
In this case, let's try to override the whole line, not just the first
few chars.

src/shared/pretty-print.c

index 8eba052f2c2c63d970363b3e7917410a038e8f53..f361c4760a0c94287093f48dd6578b711199b2b6 100644 (file)
@@ -532,7 +532,9 @@ void clear_progress_bar(const char *prefix) {
         fputc('\r', stderr);
 
         if (terminal_is_dumb())
-                fputs(strrepa(" ", utf8_console_width(prefix) + 4), /* 4: %3.0f%% */
+                fputs(strrepa(" ",
+                              prefix ? utf8_console_width(prefix) + 4 :
+                              LESS_BY(columns(), 1U)), /* 4: %3.0f%% */
                       stderr);
         else
                 fputs(ANSI_ERASE_TO_END_OF_LINE, stderr);