changeset: 6798:87911ba95dae
user:      Kevin McCarthy <ke...@8t8.us>
date:      Thu Sep 22 14:07:18 2016 -0700
link:      http://dev.mutt.org/hg/mutt/rev/87911ba95dae

Don't abort the menu editor on sigwinch. (closes #3875)

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!

diffs (37 lines):

diff -r f2ae8a2d6e1b -r 87911ba95dae curs_lib.c
--- a/curs_lib.c        Wed Sep 21 18:11:27 2016 -0700
+++ b/curs_lib.c        Thu Sep 22 14:07:18 2016 -0700
@@ -125,9 +125,10 @@
     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 ();
diff -r f2ae8a2d6e1b -r 87911ba95dae keymap.c
--- a/keymap.c  Wed Sep 21 18:11:27 2016 -0700
+++ b/keymap.c  Thu Sep 22 14:07:18 2016 -0700
@@ -461,13 +461,13 @@
     tmp = mutt_getch();
     timeout (-1);
 
-    /* hide timeouts from line editor */
+#ifdef USE_IMAP
+  gotkey:
+#endif
+    /* hide timeouts and window resizes from line editor. */
     if (menu == MENU_EDITOR && tmp.ch == -2)
       continue;
 
-#ifdef USE_IMAP
-  gotkey:
-#endif
     LastKey = tmp.ch;
     if (LastKey < 0)
       return -1;

Reply via email to