From: Michael Elkins Date: Tue, 15 Jan 2013 03:23:06 +0000 (-0800) Subject: allow use of sync-mailbox when the current limit has no visible messages X-Git-Tag: mutt-1-5-22-rel~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8c768c30c89d98cb7e9cb41e189c13b9c9578ee;p=mutt allow use of sync-mailbox when the current limit has no visible messages closes #3538 --- diff --git a/curs_main.c b/curs_main.c index b9e34bd5..aa4b044d 100644 --- a/curs_main.c +++ b/curs_main.c @@ -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) {