From 771612750bec1ec39f0fa597cb807b08ed4eaaa4 Mon Sep 17 00:00:00 2001 From: Bernard Pratz Date: Sat, 7 Jan 2017 19:08:53 +0100 Subject: [PATCH] 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 --- sidebar.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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; } -- 2.40.0