]> granicus.if.org Git - neomutt/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)
committerRichard Russon <rich@flatcap.org>
Sun, 2 Oct 2016 14:50:27 +0000 (15:50 +0100)
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 d09278fd1a014b9f1d0fb1b9de17b81d8748ccbf..e8299592934ed4255418e368dc3db9d3aef53e01 100644 (file)
@@ -129,9 +129,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 a74d49665c36b7a9b60d25c26ddc526cfbf4851b..cd8c9a0432f9ddda1193de64d333d8b90c693a78 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -459,13 +459,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;