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!
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 ();
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;