leo-arch / clifm

The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell.
https://github.com/leo-arch/clifm/wiki
GNU General Public License v2.0
1.29k stars 41 forks source link

alignment of file sizes gets disturbed on very big files #256

Closed muellerto closed 9 months ago

muellerto commented 9 months ago

Describe the bug Not a big thing. But when you have really big files the right aligned file sizes get disturbed.

Expected behavior The file sizes should all be right aligned.

Screenshots

Someone gave me really big files containing dumped database contents (with billions of spaces in them, and it's indeed also Unicode ... don't ask.) This looks like this:

 1 Stb-History-2019.rpt    - ./rw-.r--.r-- 2020-07-03 14:29:48 16583690616
 2 Stb-History-2020-1.rpt  - ./rw-.r--.r-- 2021-08-25 08:28:28  185281712
 3 Stb-History-2020-2.rpt  - ./rw-.r--.r-- 2021-08-25 16:31:06 10782348556
 4 Stb-History-2020-3.rpt  - ./rw-.r--.r-- 2021-08-25 16:51:48 8023002918
 5 Stb-History-2020-4.rpt  - ./rw-.r--.r-- 2022-03-14 13:28:00 11187323114
 6 Stb-History-2021-1.rpt  - ./rw-.r--.r-- 2022-03-14 15:15:22 13349515690
 7 Stb-History-2021-2.rpt  - ./rw-.r--.r-- 2022-11-25 13:14:30 15885306112
 8 Stb-History-2022-1.rpt  - ./rw-.r--.r-- 2022-11-25 13:56:36 15116597272
 9 _0                      7 d/rwx.r-x.r-x 2023-09-11 11:12:06          0
10 _1                      7 d/rwx.r-x.r-x 2023-09-11 11:12:31          0
11 _2                      8 d/rwx.r-x.r-x 2023-09-12 08:35:25          0
12 _3                      2 d/rwx.r-x.r-x 2023-09-12 11:49:48          0
----------------------------------------------------------------------------------
[1] 08:46 tm:DES-TM-003 /f/G
<0> $

It seems that the alignment doesn't expect such large numbers. The largest number expected is probably "N GB" - file No.4 (8 GB) is still correctly right aligned with file No.2 (176 MB) and with the 0s below.

If you have files with a size of "NN GB" (or even NNN GB) their size will be displayed but not aligned anymore.

Desktop

leo-arch commented 9 months ago

Nice! This is a good one.

Should be fixed now @muellerto.

leo-arch commented 9 months ago

the alignment doesn't expect such large numbers

You're totally right. The digits counter function was counting only up to 10 digits: extended to handle up to 19 digits.

muellerto commented 9 months ago

Oh, is there really a file system supporting 19 (!) digits? This would be N PB! (Don't think that I will ever have so much stuff all together ...)

leo-arch commented 9 months ago

Don't think that I will ever have so much stuff all together

The time will come, and our software will fail.