nano

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

commit 9d232cd8af35bbf70d53af82393404874772aab7
parent 03d296eb35d11147476bc88dc12fbc0ab84b5879
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 13 Feb 2020 13:15:46 +0100

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.

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

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