comparison src/gui_x11.c @ 20951:64c1b0796c46 v8.2.1027

patch 8.2.1027: GUI: multi-byte characters do not work in a terminal Commit: https://github.com/vim/vim/commit/820ffa567c5a4bc0d3517c79c91d63d8062c358e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 21 15:09:14 2020 +0200 patch 8.2.1027: GUI: multi-byte characters do not work in a terminal Problem: GUI: multi-byte characters do not work in a terminal. Solution: Do not assume a key is one byte. (closes https://github.com/vim/vim/issues/6304)
author Bram Moolenaar <Bram@vim.org>
date Sun, 21 Jun 2020 15:15:03 +0200
parents a5a24d688e11
children f260c1411833
comparison
equal deleted inserted replaced
20950:a8c5a81384da 20951:64c1b0796c46
936 * code. 936 * code.
937 */ 937 */
938 if (len == -3) 938 if (len == -3)
939 key = TO_SPECIAL(string[1], string[2]); 939 key = TO_SPECIAL(string[1], string[2]);
940 else 940 else
941 key = string[0]; 941 {
942 string[len] = NUL;
943 key = mb_ptr2char(string);
944 }
942 key = simplify_key(key, &modifiers); 945 key = simplify_key(key, &modifiers);
943 if (key == CSI) 946 if (key == CSI)
944 key = K_CSI; 947 key = K_CSI;
945 if (IS_SPECIAL(key)) 948 if (IS_SPECIAL(key))
946 { 949 {
949 string[2] = K_THIRD(key); 952 string[2] = K_THIRD(key);
950 len = 3; 953 len = 3;
951 } 954 }
952 else 955 else
953 { 956 {
954 string[0] = key; 957 len = mb_char2bytes(key, string);
955 len = 1;
956 958
957 // Remove the SHIFT modifier for keys where it's already included, 959 // Remove the SHIFT modifier for keys where it's already included,
958 // e.g., '(', '!' and '*'. 960 // e.g., '(', '!' and '*'.
959 if (!ASCII_ISALPHA(key) && key > 0x20 && key < 0x7f) 961 if (!ASCII_ISALPHA(key) && key > 0x20 && key < 0x7f)
960 modifiers &= ~MOD_MASK_SHIFT; 962 modifiers &= ~MOD_MASK_SHIFT;