input: flush the keystroke buffer upon any kind of error condition

This stops the execution of a macro or a string bind whenever something
unexpected happens, to prevent the waiting keystrokes from doing things
that were not intended.

Especially this prevents an infinite loop: when during the recording
of a macro the `runmacro` keystroke is typed in some menu (where the
keystroke is not bound), and the macro is later replayed in a way that
results in exiting from that menu before the `runmacro` keystroke gets
replayed...

This fixes https://savannah.gnu.org/bugs/?65301.
The issue was reported by `correctmost`.

Bug existed since version 2.9.0, since the macro feature was introduced.
This commit is contained in:
Benno Schulenberg 2017-10-12 20:00:25 +02:00
parent 0e44752ba1
commit 77d74b5d81
1 changed files with 4 additions and 0 deletions

View File

@ -2308,6 +2308,10 @@ void statusline(message_type importance, const char *msg, ...)
int colorpair;
va_list ap;
/* Drop all waiting keystrokes upon any kind of "error". */
if (importance >= AHEM)
waiting_codes = 0;
/* Ignore a message with an importance that is lower than the last one. */
if (importance < lastmessage && lastmessage > NOTICE)
return;