aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/input.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2020-08-08 08:57:35 -0400
committerJames McCoy <jamessan@jamessan.com>2020-08-08 08:57:35 -0400
commit840c12c10741d8f70e1787534fb6ea6d2b70edee (patch)
treef89ad27acbbf0b36db7ac08eeae0b8362da1fabb /src/nvim/os/input.c
parente813ec79c201c85c5af3b10c051ae92ab5cb8606 (diff)
parentf26df8bb66158baacb79c79822babaf137607cd6 (diff)
downloadrneovim-840c12c10741d8f70e1787534fb6ea6d2b70edee.tar.gz
rneovim-840c12c10741d8f70e1787534fb6ea6d2b70edee.tar.bz2
rneovim-840c12c10741d8f70e1787534fb6ea6d2b70edee.zip
Merge remote-tracking branch 'upstream/master' into libcallnr
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r--src/nvim/os/input.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index c1580c5fc3..b7878d9da8 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -188,8 +188,13 @@ size_t input_enqueue(String keys)
char *ptr = keys.data;
char *end = ptr + keys.size;
- while (rbuffer_space(input_buffer) >= 6 && ptr < end) {
- uint8_t buf[6] = { 0 };
+ while (rbuffer_space(input_buffer) >= 19 && ptr < end) {
+ // A "<x>" form occupies at least 1 characters, and produces up
+ // to 19 characters (1 + 5 * 3 for the char and 3 for a modifier).
+ // In the case of K_SPECIAL(0x80) or CSI(0x9B), 3 bytes are escaped and
+ // needed, but since the keys are UTF-8, so the first byte cannot be
+ // K_SPECIAL(0x80) or CSI(0x9B).
+ uint8_t buf[19] = { 0 };
unsigned int new_size
= trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true,
false);