From: Bernard Pratz Date: Sat, 7 Jan 2017 18:08:53 +0000 (+0100) Subject: Makes the sidebar show the real msg count on the current mailbox X-Git-Tag: neomutt-20170128~30^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=771612750bec1ec39f0fa597cb807b08ed4eaaa4;p=neomutt Makes the sidebar show the real msg count on the current mailbox run a notmuch count when loading values for the currently highlighted mailbox when drawing the sidebar up, to show the request's total number instead of just the window's number. Signed-off-by: Guyzmo --- diff --git a/sidebar.c b/sidebar.c index c497ff353..b455f3adf 100644 --- a/sidebar.c +++ b/sidebar.c @@ -31,6 +31,10 @@ #include "sort.h" #include "sidebar.h" +#ifdef USE_NOTMUCH +#include "mutt_notmuch.h" +#endif + /* Previous values for some sidebar config */ static short PreviousSort = SORT_ORDER; /* sidebar_sort_method */ @@ -704,8 +708,15 @@ static void draw_sidebar (int num_rows, int num_cols, int div_width) if (Context && Context->realpath && !mutt_strcmp (b->realpath, Context->realpath)) { - b->msg_unread = Context->unread; - b->msg_count = Context->msgcount; +#ifdef USE_NOTMUCH + if (b->magic == MUTT_NOTMUCH) + nm_nonctx_get_count(b->realpath, &b->msg_count, &b->msg_unread); + else +#endif + { + b->msg_unread = Context->unread; + b->msg_count = Context->msgcount; + } b->msg_flagged = Context->flagged; }