repart: tweak byte value output

So far, when outputing information about copy progress we'd suppress the
digit after the dot if it is zero. That makes the progress bar a bit
"jumpy", because sometimes there are two more character cells used than
other times. Let's just always output one digit after the dot here
hence, to avoid this.
This commit is contained in:
Lennart Poettering
2025-09-19 16:46:07 +02:00
parent 222dcf3bc2
commit 2f5fb752a6
4 changed files with 39 additions and 27 deletions
+2 -1
View File
@@ -39,7 +39,8 @@ char* format_bytes_full(char *buf, size_t l, uint64_t t, FormatBytesFlag flag) {
(t / table[i + 1].factor * 10 / table[n - 1].factor) % 10 :
(t * 10 / table[i].factor) % 10;
if (FLAGS_SET(flag, FORMAT_BYTES_BELOW_POINT) && remainder > 0)
if (FLAGS_SET(flag, FORMAT_BYTES_ALWAYS_POINT) ||
(FLAGS_SET(flag, FORMAT_BYTES_BELOW_POINT) && remainder > 0))
(void) snprintf(buf, l,
"%" PRIu64 ".%" PRIu64 "%s",
t / table[i].factor,