]> granicus.if.org Git - neomutt/commitdiff
Makes the sidebar show the real msg count on the current mailbox
authorBernard Pratz <guyzmo+github+pub@m0g.net>
Sat, 7 Jan 2017 18:08:53 +0000 (19:08 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 18 Jan 2017 16:41:46 +0000 (16:41 +0000)
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 <guyzmo+github+pub@m0g.net>
sidebar.c

index c497ff353d17370883288b7e799ed8bf4b12f2bf..b455f3adfd0c0918a9794141cc277b698b919940 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
 #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;
     }