input: reset the counters when a three-digit sequence is not completed

When <Esc><Esc> is followed by digit 0 or 1 or 2 but then NOT two more
digits follow, then both the escape counter and the digit counter should
start afresh when a new ESC code arrives.

This fixes https://savannah.gnu.org/bugs/?58788.

Bug existed since before version 2.0.6.
This commit is contained in:
Benno Schulenberg 2020-07-20 11:05:39 +02:00
parent 180a53cc0c
commit a08ca026f0

View File

@ -895,8 +895,10 @@ int parse_kbinput(WINDOW *win)
if (keycode == ESC_CODE) {
/* Increment the escape counter, but trim an overabundance. */
escapes++;
if (escapes > 3)
if (escapes > 3 || digit_count > 0) {
digit_count = 0;
escapes = 1;
}
/* Take note when an Esc arrived by itself. */
solitary = (key_buffer_len == 0);
return ERR;