Change file size units to IEC 80000-13:2025 (binary multiples) (#2062)

* Change file size units from SI to IEC 80000-13:2025

Increase left-padded (%S) file size string length to 5 characters

Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>

* Add note about used IEC units for file size in docs

---------

Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
This commit is contained in:
Andrew VoynovandJoe Lim authored and GitHub committed 2025-07-26 19:03:13 +10:00
1 parent d60acef469
commit 23b30ae1ee
10 files changed
+90 -56

No files matched your search

+4 -4
View File
@@ -316,9 +316,9 @@ func fileInfo(f *file, d *dir, userWidth int, groupWidth int, customWidth int) (
if f.IsDir() && f.dirSize < 0 {
sz = "-"
} else {
sz = humanize(f.TotalSize())
sz = humanize(uint64(f.TotalSize()))
}
fmt.Fprintf(&info, " %4s", sz)
fmt.Fprintf(&info, " %5s", sz)
case "time":
fmt.Fprintf(&info, " %*s", max(len(gOpts.infotimefmtnew), len(gOpts.infotimefmtold)), infotimefmt(f.ModTime()))
case "atime":
@@ -838,8 +838,8 @@ func (ui *ui) loadFileInfo(nav *nav) {
replace("%c", linkCount(curr))
replace("%u", userName(curr))
replace("%g", groupName(curr))
replace("%s", humanize(curr.Size()))
replace("%S", fmt.Sprintf("%4s", humanize(curr.Size())))
replace("%s", humanize(uint64(curr.Size())))
replace("%S", fmt.Sprintf("%5s", humanize(uint64(curr.Size()))))
replace("%t", curr.ModTime().Format(gOpts.timefmt))
replace("%l", curr.linkTarget)