]> granicus.if.org Git - neomutt/commitdiff
mutt_pretty_size: show real number for small files
authorOlaf Hering <olaf@aepfle.de>
Tue, 3 Dec 2013 15:43:49 +0000 (16:43 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 13 Jan 2018 22:42:56 +0000 (22:42 +0000)
If a file is smaller than a certain size it is unfriendly to print 0K or
0,1K as number of mails or as file size. Instead use the real number.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
muttlib.c

index 2b867ad9909b40dc7f0db8d89605ad198bdf1198..599ad43f0b9e87e5f92b0c0c9a1e192487706296 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -568,8 +568,8 @@ void mutt_pretty_mailbox(char *s, size_t buflen)
 
 void mutt_pretty_size(char *s, size_t len, size_t n)
 {
-  if (n == 0)
-    mutt_str_strfcpy(s, "0K", len);
+  if (n < 1000)
+    snprintf(s, len, "%d", (int) n);
   else if (n < 10189) /* 0.1K - 9.9K */
     snprintf(s, len, "%3.1fK", (n < 103) ? 0.1 : n / 1024.0);
   else if (n < 1023949) /* 10K - 999K */