From: Olaf Hering Date: Tue, 3 Dec 2013 15:43:49 +0000 (+0100) Subject: mutt_pretty_size: show real number for small files X-Git-Tag: neomutt-20180223~45^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e96005e08d9da09f84dd01118c0b0218d6324d0;p=neomutt mutt_pretty_size: show real number for small files 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 --- diff --git a/muttlib.c b/muttlib.c index 2b867ad99..599ad43f0 100644 --- 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 */