input: count a manually entered unicode as one character

This fixes https://savannah.gnu.org/bugs/?50403.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
master
Benno Schulenberg 2017-02-28 14:45:02 +01:00
parent 29681e0e9f
commit 91910b2364
1 changed files with 4 additions and 2 deletions

View File

@ -1486,6 +1486,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
} }
#endif #endif
*count = 1;
#ifdef ENABLE_UTF8 #ifdef ENABLE_UTF8
if (using_utf8()) { if (using_utf8()) {
/* Check whether the first code is a valid starter digit: 0 or 1. */ /* Check whether the first code is a valid starter digit: 0 or 1. */
@ -1518,6 +1520,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
/* Insert the multibyte sequence into the input buffer. */ /* Insert the multibyte sequence into the input buffer. */
unget_input(seq, uni_mb_len); unget_input(seq, uni_mb_len);
*count = uni_mb_len;
free(seq); free(seq);
free(uni_mb); free(uni_mb);
} }
@ -1528,8 +1532,6 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
free(kbinput); free(kbinput);
*count = 1;
/* If this is an iTerm/Eterm/rxvt double escape, take both Escapes. */ /* If this is an iTerm/Eterm/rxvt double escape, take both Escapes. */
if (key_buffer_len > 3 && *key_buffer == ESC_CODE && if (key_buffer_len > 3 && *key_buffer == ESC_CODE &&
key_buffer[1] == ESC_CODE && key_buffer[2] == '[') key_buffer[1] == ESC_CODE && key_buffer[2] == '[')