# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1306149754 -7200
# Branch HEAD
# Node ID 356b22030d868e34fbc552a358398d068d776a4a
# Parent  0d1d529d6205a2144f5c1495fb2e008a942495b2
mutt_pretty_size: show real number for small files

With the upcoming change for bug #2421 to show the number of mails in a
maildir, update the format of small files. If a file is smaller than a certain
size it is user 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 <[email protected]>

diff -r 0d1d529d6205 -r 356b22030d86 muttlib.c
--- a/muttlib.c Mon May 23 13:22:33 2011 +0200
+++ b/muttlib.c Mon May 23 13:22:34 2011 +0200
@@ -879,8 +879,8 @@ void mutt_pretty_mailbox (char *s, size_
 
 void mutt_pretty_size (char *s, size_t len, LOFF_T n)
 {
-  if (n == 0)
-    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 */

Reply via email to