diff --git a/doc/NEWS.md b/doc/NEWS.md index 5037ac2..68fbdf4 100644 --- a/doc/NEWS.md +++ b/doc/NEWS.md @@ -1,4 +1,5 @@ 0.0.20230723-UNRELEASED + * fix: correct byte prefix size to 2 spaces in rate display, so progress display size remains constant at low transfer rates * cleanup: Rewrote `configure.in` as per suggestions in newer "`autoconf`" manuals * cleanup: replaced `header.in` with one generated by "`autoheader`", moving custom logic to a separate header file "`config-aux.h`" * cleanup: added copyright notice to all source files as per GNU standards diff --git a/src/pv/display.c b/src/pv/display.c index 2219a37..ddf0bcd 100644 --- a/src/pv/display.c +++ b/src/pv/display.c @@ -199,8 +199,13 @@ static void pv__si_prefix(long double *value, char *prefix, prefix[0] = *i; } - if (is_bytes && prefix[0] != ' ') { - prefix[1] = 'i'; + /* + * Byte prefixes are of the form "KiB" rather than "KB", so that's + * two characters, not one - meaning that for just "B", the prefix + * is two spaces, not one. + */ + if (is_bytes) { + prefix[1] = (prefix[0] == ' ' ? ' ' : 'i'); prefix[2] = 0; } }