diff --git a/src/import/importctl.c b/src/import/importctl.c index 27c26a70e88..85903bb8c69 100644 --- a/src/import/importctl.c +++ b/src/import/importctl.c @@ -45,7 +45,7 @@ static const char* arg_format = NULL; static sd_json_format_flags_t arg_json_format_flags = SD_JSON_FORMAT_OFF; static ImageClass arg_image_class = _IMAGE_CLASS_INVALID; -#define PROGRESS_PREFIX "Total: " +#define PROGRESS_PREFIX "Total:" static int settle_image_class(void) { diff --git a/src/partition/repart.c b/src/partition/repart.c index e14c9a4750b..48b3b430137 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -4553,7 +4553,7 @@ static int progress_bytes(uint64_t n_bytes, void *userdata) { p->copy_blocks_done += n_bytes; - if (asprintf(&s, "%s %s %s %s/%s ", + if (asprintf(&s, "%s %s %s %s/%s", strna(p->copy_blocks_path), special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), strna(p->definition_path), diff --git a/src/shared/pretty-print.c b/src/shared/pretty-print.c index f361c4760a0..b2a1393fcea 100644 --- a/src/shared/pretty-print.c +++ b/src/shared/pretty-print.c @@ -469,12 +469,14 @@ void draw_progress_bar(const char *prefix, double percentage) { setvbuf(stderr, buffer, _IOFBF, sizeof(buffer)); fputc('\r', stderr); - if (prefix) + if (prefix) { fputs(prefix, stderr); + fputc(' ', stderr); + } if (!terminal_is_dumb()) { size_t cols = columns(); - size_t prefix_width = utf8_console_width(prefix); + size_t prefix_width = utf8_console_width(prefix) + 1 /* space */; size_t length = cols > prefix_width + 6 ? cols - prefix_width - 6 : 0; if (length > 5 && percentage >= 0.0 && percentage <= 100.0) { @@ -533,8 +535,8 @@ void clear_progress_bar(const char *prefix) { if (terminal_is_dumb()) fputs(strrepa(" ", - prefix ? utf8_console_width(prefix) + 4 : - LESS_BY(columns(), 1U)), /* 4: %3.0f%% */ + prefix ? utf8_console_width(prefix) + 5 : /* %3.0f%% (4 chars) + space */ + LESS_BY(columns(), 1U)), stderr); else fputs(ANSI_ERASE_TO_END_OF_LINE, stderr); diff --git a/src/test/test-progress-bar.c b/src/test/test-progress-bar.c index b47adf0c289..abc1d292dcb 100644 --- a/src/test/test-progress-bar.c +++ b/src/test/test-progress-bar.c @@ -4,7 +4,7 @@ #include "random-util.h" #include "tests.h" -#define PROGRESS_PREFIX "test: " +#define PROGRESS_PREFIX "test:" TEST(progress_bar) {