diff --git a/ncdu.1 b/ncdu.1 index 1755612..0deeed7 100644 --- a/ncdu.1 +++ b/ncdu.1 @@ -286,7 +286,7 @@ when given twice it will also add thus ensuring that there is no way to modify the file system from within .Nm . .It Fl \-si , \-no\-si -List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB, etc), as +List sizes using base 10 prefixes, that is, powers of 1000 (kB, MB, etc), as defined in the International System of Units (SI), instead of the usual base 2 prefixes (KiB, MiB, etc). .It Fl \-disk\-usage , \-apparent\-size diff --git a/src/ui.zig b/src/ui.zig index 9aab964..2eacd26 100644 --- a/src/ui.zig +++ b/src/ui.zig @@ -419,7 +419,7 @@ pub const FmtSize = struct { pub fn fmt(v: u64) FmtSize { if (main.config.si) { if (v < 1000) { return FmtSize.init(" B", v, 10, 1); } - else if (v < 999_950) { return FmtSize.init(" KB", v, 1, 100); } + else if (v < 999_950) { return FmtSize.init(" kB", v, 1, 100); } else if (v < 999_950_000) { return FmtSize.init(" MB", v, 1, 100_000); } else if (v < 999_950_000_000) { return FmtSize.init(" GB", v, 1, 100_000_000); } else if (v < 999_950_000_000_000) { return FmtSize.init(" TB", v, 1, 100_000_000_000); } @@ -452,11 +452,11 @@ test "fmtsize" { main.config.si = true; try FmtSize.fmt( 0).testEql(" 0.0 B"); try FmtSize.fmt( 999).testEql("999.0 B"); - try FmtSize.fmt( 1000).testEql(" 1.0 KB"); - try FmtSize.fmt( 1049).testEql(" 1.0 KB"); - try FmtSize.fmt( 1050).testEql(" 1.1 KB"); - try FmtSize.fmt( 999_899).testEql("999.9 KB"); - try FmtSize.fmt( 999_949).testEql("999.9 KB"); + try FmtSize.fmt( 1000).testEql(" 1.0 kB"); + try FmtSize.fmt( 1049).testEql(" 1.0 kB"); + try FmtSize.fmt( 1050).testEql(" 1.1 kB"); + try FmtSize.fmt( 999_899).testEql("999.9 kB"); + try FmtSize.fmt( 999_949).testEql("999.9 kB"); try FmtSize.fmt( 999_950).testEql(" 1.0 MB"); try FmtSize.fmt( 1000_000).testEql(" 1.0 MB"); try FmtSize.fmt( 999_850_009).testEql("999.9 MB");