]> granicus.if.org Git - mutt/commitdiff
Don't abort the menu editor on sigwinch. (closes #3875)
authorKevin McCarthy <kevin@8t8.us>
Thu, 22 Sep 2016 21:07:18 +0000 (14:07 -0700)
committerKevin McCarthy <kevin@8t8.us>
Thu, 22 Sep 2016 21:07:18 +0000 (14:07 -0700)
getch() will return ERR on sigwinch when timeout() is called with a
positive value.  mutt_getch() will therefore return ch==-2 for both a
timeout and a sigwinch in this case.

The imap code in km_dokey() exits out of the ImapKeepalive loop for a
SigWinch, and was skipping past the check for MENU_EDITOR and
tmp.ch==-2.  Move this check below the gotkey: label so the
ImapKeepalive loop behaves the same as the Timeout code.

Thanks to nicop for reporting the problem and for the initial patch!

curs_lib.c
keymap.c

index 8b21c43fb08cea5d3221d7b2c031d7373eabc279..b747b50d61be373001fe35967dc2d28333efd720 100644 (file)
@@ -125,9 +125,10 @@ event_t mutt_getch (void)
     return err;
   }
 
-  if(ch == ERR)
+  /* either timeout, a sigwinch (if timeout is set), or the terminal
+   * has been lost */
+  if (ch == ERR)
   {
-    /* either timeout or the terminal has been lost */
     if (!isatty (0))
     {
       endwin ();
index 8b8b972b5bd7f1707a8ff21707c5d2e133d73496..07147bd218e765309083342499be2a99de29d36a 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -461,13 +461,13 @@ int km_dokey (int menu)
     tmp = mutt_getch();
     timeout (-1);
 
-    /* hide timeouts from line editor */
-    if (menu == MENU_EDITOR && tmp.ch == -2)
-      continue;
-
 #ifdef USE_IMAP
   gotkey:
 #endif
+    /* hide timeouts and window resizes from line editor. */
+    if (menu == MENU_EDITOR && tmp.ch == -2)
+      continue;
+
     LastKey = tmp.ch;
     if (LastKey < 0)
       return -1;