]> granicus.if.org Git - neomutt/commitdiff
allow use of sync-mailbox when the current limit has no visible messages
authorMichael Elkins <me@mutt.org>
Tue, 15 Jan 2013 03:23:06 +0000 (19:23 -0800)
committerMichael Elkins <me@mutt.org>
Tue, 15 Jan 2013 03:23:06 +0000 (19:23 -0800)
closes #3538

curs_main.c

index b9e34bd585ca30a6ae8c3e50df377301d52bfc96..aa4b044d6520ccc3066540af5ad88f5341be054c 100644 (file)
@@ -1011,7 +1011,6 @@ int mutt_index_menu (void)
          break;
 
        CHECK_MSGCOUNT;
-        CHECK_VISIBLE;
        CHECK_READONLY;
        {
          int oldvcount = Context->vcount;
@@ -1019,15 +1018,19 @@ int mutt_index_menu (void)
          int check, newidx;
          HEADER *newhdr = NULL;
 
-         /* threads may be reordered, so figure out what header the cursor
-          * should be on. #3092 */
-         newidx = menu->current;
-         if (CURHDR->deleted)
-           newidx = ci_next_undeleted (menu->current);
-         if (newidx < 0)
-           newidx = ci_previous_undeleted (menu->current);
-         if (newidx >= 0)
-           newhdr = Context->hdrs[Context->v2r[newidx]];
+         /* don't attempt to move the cursor if there are no visible messages in the current limit */
+         if (menu->current < Context->vcount)
+         {
+           /* threads may be reordered, so figure out what header the cursor
+            * should be on. #3092 */
+           newidx = menu->current;
+           if (CURHDR->deleted)
+             newidx = ci_next_undeleted (menu->current);
+           if (newidx < 0)
+             newidx = ci_previous_undeleted (menu->current);
+           if (newidx >= 0)
+             newhdr = Context->hdrs[Context->v2r[newidx]];
+         }
 
          if ((check = mx_sync_mailbox (Context, &index_hint)) == 0)
          {