]> granicus.if.org Git - mutt/commitdiff
Clean up pager change folder aborts to return to pager.
authorKevin McCarthy <kevin@8t8.us>
Thu, 17 Oct 2019 10:34:55 +0000 (18:34 +0800)
committerKevin McCarthy <kevin@8t8.us>
Thu, 17 Oct 2019 10:34:55 +0000 (18:34 +0800)
Changing folder from within the pager behaved inconsistently when
aborting, or upon a normal error.  It would sometimes return the pager
and other times return to the index.

Ensure it returns to the pager, except in the case where
mx_close_mailbox() fails due to a new mail or reopen event.  In that
case we likely want to be in the index - the message we were viewing
could have disappeared or relocated.

curs_main.c

index 35f106b09df9464b106e72098ed94eb99a162a9d..0f93df3ffb5a1046afa6ece5cdc68ca39d996a29 100644 (file)
@@ -1277,7 +1277,7 @@ int mutt_index_menu (void)
       case OP_MAIN_CHANGE_FOLDER_READONLY:
       {
         BUFFER *folderbuf;
-        int cont = 0;  /* Set if we want to continue instead of break */
+        int pager_return = 1;  /* return to display message in pager */
 
         folderbuf = mutt_buffer_pool_get ();
 
@@ -1316,14 +1316,7 @@ int mutt_index_menu (void)
          mutt_buffer_buffy (folderbuf);
 
           if (mutt_buffer_enter_fname (cp, folderbuf, 1) == -1)
-          {
-            if (in_pager)
-            {
-              op = OP_DISPLAY_MESSAGE;
-              cont = 1;
-            }
             goto changefoldercleanup;
-          }
        }
 
         if (!mutt_buffer_len (folderbuf))
@@ -1338,6 +1331,9 @@ int mutt_index_menu (void)
          goto changefoldercleanup;
        }
 
+        /* past this point, we don't return to the pager on error */
+        pager_return = 0;
+
        /* keepalive failure in mutt_enter_fname may kill connection. #3028 */
        if (Context && !Context->path)
          FREE (&Context);
@@ -1410,10 +1406,12 @@ int mutt_index_menu (void)
 
       changefoldercleanup:
         mutt_buffer_pool_release (&folderbuf);
-        if (cont)
+        if (in_pager && pager_return)
+        {
+          op = OP_DISPLAY_MESSAGE;
           continue;
-        else
-          break;
+        }
+        break;
       }
 
       case OP_DISPLAY_MESSAGE: