On 2017-11-10 08:36:05 -0800, Kevin J. McCarthy wrote: > On Fri, Nov 10, 2017 at 01:12:55PM +0100, Daan van Rossum wrote: > > 2. add to status_format a sequence like: > > %R number of read messages > > This one I'm not enthused about. The count used above is not stored in > the context, and I don't really want to add the logic everywhere to keep > that count correct.
But the total number of messages and the number of unread messages are in the context. Thus you would only need to do a subtraction dynamically. What about the attached patch? -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
diff -r fbf01f1c87a3 init.h --- a/init.h Fri Nov 10 13:06:43 2017 -0800 +++ b/init.h Sat Nov 11 02:38:42 2017 +0100 @@ -3560,6 +3560,7 @@ ** .dt %P .dd percentage of the way through the index ** .dt %r .dd modified/read-only/won't-write/attach-message indicator, ** according to $$status_chars + ** .dt %R .dd number of read messages * ** .dt %s .dd current sorting mode ($$sort) ** .dt %S .dd current aux sorting method ($$sort_aux) ** .dt %t .dd number of tagged messages * diff -r fbf01f1c87a3 status.c --- a/status.c Fri Nov 10 13:06:43 2017 -0800 +++ b/status.c Sat Nov 11 02:38:42 2017 +0100 @@ -55,6 +55,7 @@ * %p = number of postponed messages [option] * %P = percent of way through index * %r = readonly/wontwrite/changed flag + * %R = number of read messages [option] * %s = current sorting method ($sort) * %S = current aux sorting method ($sort_aux) * %t = # of tagged messages [option] @@ -236,7 +237,21 @@ snprintf (buf, buflen, "%s", StChars->chars[i]); break; } - + + case 'R': + { + int read = Context ? Context->msgcount - Context->unread : 0; + + if (!optional) + { + snprintf (fmt, sizeof (fmt), "%%%sd", prefix); + snprintf (buf, buflen, fmt, read); + } + else if (!read) + optional = 0; + break; + } + case 's': snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (buf, buflen, fmt,