From: Kevin McCarthy Date: Thu, 22 Sep 2016 21:07:18 +0000 (-0700) Subject: Don't abort the menu editor on sigwinch. (closes #3875) X-Git-Tag: neomutt-20170225~32^2~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c645be01a4762efa7610b60a1da684e3b8372990;p=neomutt 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! --- diff --git a/curs_lib.c b/curs_lib.c index 8b21c43fb..b747b50d6 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -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 (); diff --git a/keymap.c b/keymap.c index 8b8b972b5..07147bd21 100644 --- 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;