Display human readable sizes in panels #3165
Labels
area: core
Issues not related to a specific subsystem
prio: medium
Has the potential to affect progress
Milestone
Important
This issue was migrated from Trac:
wentasah
(michal.sojka@….cz)gotar@….pl
When midnight commander displays the size of a file, it tries to
display as much digits as fits into the size column (7 characters
wide). The result is that for a 3 MB file it shows, for example, 3010050.
In many cases, it is not important to know the exact number
of bytes in a file, but only an approximate size (3 MB). Short numbers
are more "human friendly".
This patch adds a configuration option that enables displaying such
human readable sizes in panels. The "human readable" means that at
most three digits are displayed for each file size. This is
accomplished by modifying function size_trunc_len(). Since the comment
of this function says that floating point should be avoided by any
means, the implementation is not as trivial as it could be. It
displays floating point numbers by displaying integer and fractional
parts separately as integers.
The effect of this patch is shown in the following table. "si" and
"hr" denote the values use_si and human_readable parameters of the
size_trunc_len() function. The table shows the results of the function
for different sizes.
Currently, the decimal separator (".") is hardcoded and independent of
user's locale.
If anyone wants to test the patch, the table was created with the code
below.
Note
Original attachments:
wentasah
(michal.sojka@….cz) onFeb 3, 2014 at 0:43 UTC
The text was updated successfully, but these errors were encountered: