From c200fb1712bb627c51d3d1809d1a1772e750c24f Mon Sep 17 00:00:00 2001 From: Andrew Voynov Date: Fri, 20 Oct 2023 23:42:15 +0300 Subject: [PATCH 1/2] Added binary (IEC) prefixes --- lua/nvim-tree/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/utils.lua b/lua/nvim-tree/utils.lua index 8e9261814ed..042a091a337 100644 --- a/lua/nvim-tree/utils.lua +++ b/lua/nvim-tree/utils.lua @@ -292,7 +292,7 @@ function M.format_bytes(bytes) pow = pow + 1 - return (units[pow] == nil) and (bytes .. "B") or (value .. units[pow]) + return (units[pow] == nil) and (bytes .. units[1]) or (value .. units[pow] .. "i" .. units[1]) end function M.key_by(tbl, key) From 54626b2b7723268d070f67cc7388c1ad109a5a02 Mon Sep 17 00:00:00 2001 From: Andrew Voynov Date: Sat, 21 Oct 2023 00:06:17 +0300 Subject: [PATCH 2/2] Added missing binary prefixes --- lua/nvim-tree/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/utils.lua b/lua/nvim-tree/utils.lua index 042a091a337..a0cf9c23741 100644 --- a/lua/nvim-tree/utils.lua +++ b/lua/nvim-tree/utils.lua @@ -281,7 +281,7 @@ function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remo end function M.format_bytes(bytes) - local units = { "B", "K", "M", "G", "T" } + local units = { "B", "K", "M", "G", "T", "P", "E", "Z", "Y" } bytes = math.max(bytes, 0) local pow = math.floor((bytes and math.log(bytes) or 0) / math.log(1024))