summaryrefslogtreecommitdiff
path: root/src/gui_x11.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-21 15:09:14 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-21 15:09:14 +0200
commit820ffa567c5a4bc0d3517c79c91d63d8062c358e (patch)
tree53ad1c5ef5ed6de0a4f1f8f66dada6a96f52fd23 /src/gui_x11.c
parenta3b7fdc1bb227897f41b8f2958a48d0a26292ff7 (diff)
downloadvim-git-820ffa567c5a4bc0d3517c79c91d63d8062c358e.tar.gz
patch 8.2.1027: GUI: multi-byte characters do not work in a terminalv8.2.1027
Problem: GUI: multi-byte characters do not work in a terminal. Solution: Do not assume a key is one byte. (closes #6304)
Diffstat (limited to 'src/gui_x11.c')
-rw-r--r--src/gui_x11.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui_x11.c b/src/gui_x11.c
index a64bc3bd9..26d02e773 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -938,7 +938,10 @@ gui_x11_key_hit_cb(
if (len == -3)
key = TO_SPECIAL(string[1], string[2]);
else
- key = string[0];
+ {
+ string[len] = NUL;
+ key = mb_ptr2char(string);
+ }
key = simplify_key(key, &modifiers);
if (key == CSI)
key = K_CSI;
@@ -951,8 +954,7 @@ gui_x11_key_hit_cb(
}
else
{
- string[0] = key;
- len = 1;
+ len = mb_char2bytes(key, string);
// Remove the SHIFT modifier for keys where it's already included,
// e.g., '(', '!' and '*'.