repart: make prefix argument to clear_progress_bar() optional

In this case, let's try to override the whole line, not just the first
few chars.
This commit is contained in:
Lennart Poettering 2024-05-24 13:56:47 +02:00
parent 953bddee2f
commit ad25ede488

View 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);