input: keep a multibyte character together during verbatim entry

When the user (unexpectedly) types a multibyte character after M-V,
put its first byte back into the keyboard buffer, so that the next
call of process_a_keystroke() will retrieve the byte sequence as a
whole, and will inject them as one character into the edit buffer.

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

Bug existed since version 2.6.3, commit 08c51cfd.
master
Benno Schulenberg 2020-02-13 13:15:46 +01:00
parent 03d296eb35
commit 9d232cd8af
1 changed files with 6 additions and 0 deletions

View File

@ -1601,6 +1601,12 @@ char *get_verbatim_kbinput(WINDOW *win, size_t *count)
beep();
}
/* If it is an incomplete Unicode sequence, stuff it back. */
if (input != NULL && *input >= 0x80 && *count == 1) {
put_back(*input);
*count = 0;
}
/* Turn flow control characters back on if necessary and turn the
* keypad back on if necessary now that we're done. */
if (ISSET(PRESERVE))