nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 77d74b5d811f6507a69e90cff77a903073c733da
parent 0e44752ba1474282cbc44a09afefee5c573e4878
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 12 Oct 2017 20:00:25 +0200

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.

Diffstat:
Msrc/winio.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -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;