From 91910b2364ab3515e3e8245cafee6aa5083f59d8 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 28 Feb 2017 14:45:02 +0100
Subject: [PATCH] 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>
---
 src/winio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index b08ae88a..db998d97 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1486,6 +1486,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
     }
 #endif
 
+    *count = 1;
+
 #ifdef ENABLE_UTF8
     if (using_utf8()) {
 	/* 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. */
 	    unget_input(seq, uni_mb_len);
 
+	    *count = uni_mb_len;
+
 	    free(seq);
 	    free(uni_mb);
 	}
@@ -1528,8 +1532,6 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
 
     free(kbinput);
 
-    *count = 1;
-
     /* If this is an iTerm/Eterm/rxvt double escape, take both Escapes. */
     if (key_buffer_len > 3 && *key_buffer == ESC_CODE &&
 		key_buffer[1] == ESC_CODE && key_buffer[2] == '[')
-- 
GitLab