From: Kevin McCarthy Date: Sun, 3 Jun 2018 21:05:13 +0000 (-0700) Subject: Change direct mutt_getch() callers to handle new mail event. X-Git-Tag: 2019-10-25~668^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f49da35dac747d169dbbe0bd6b2ca0c3548f275d;p=neomutt Change direct mutt_getch() callers to handle new mail event. The inotify handler now returns -2 (timeout) on a new mail event. Change the direct callers to ignore, so prompts aren't strangely aborted. Also, fix mutt_change_flag() to call mutt_refresh() before the prompt. Apparently ncurses getch() was doing this for us, but now that we are polling STDIN instead, the prompt wasn't displaying. --- diff --git a/curs_lib.c b/curs_lib.c index 961928674..fac01c5d2 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -575,7 +575,10 @@ int mutt_enter_fname_full(const char *prompt, char *buf, size_t buflen, bool mai mutt_window_clrtoeol(MuttMessageWindow); mutt_refresh(); - ch = mutt_getch(); + do + { + ch = mutt_getch(); + } while (ch.ch == -2); if (ch.ch < 0) { mutt_window_clearline(MuttMessageWindow, 0); diff --git a/enter.c b/enter.c index 47974ba01..813966f32 100644 --- a/enter.c +++ b/enter.c @@ -681,7 +681,10 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, bool mu case OP_EDITOR_QUOTE_CHAR: { struct Event event; - event = mutt_getch(); + do + { + event = mutt_getch(); + } while (event.ch == -2); if (event.ch >= 0) { LastKey = event.ch; diff --git a/flags.c b/flags.c index 479c785f6..f90c1a370 100644 --- a/flags.c +++ b/flags.c @@ -431,8 +431,12 @@ int mutt_change_flag(struct Header *h, int bf) mutt_window_mvprintw(MuttMessageWindow, 0, 0, "%s? (D/N/O/r/*/!): ", bf ? _("Set flag") : _("Clear flag")); mutt_window_clrtoeol(MuttMessageWindow); + mutt_refresh(); - event = mutt_getch(); + do + { + event = mutt_getch(); + } while (event.ch == -2); i = event.ch; if (i < 0) { diff --git a/menu.c b/menu.c index 2a2ef281b..0db926086 100644 --- a/menu.c +++ b/menu.c @@ -1248,7 +1248,10 @@ static int menu_dialog_dokey(struct Menu *menu, int *ip) struct Event ch; char *p = NULL; - ch = mutt_getch(); + do + { + ch = mutt_getch(); + } while (ch.ch == -2); if (ch.ch < 0) {