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 #6304)
This commit is contained in:
@ -1215,7 +1215,10 @@ key_press_event(GtkWidget *widget UNUSED,
|
|||||||
if (len == -3)
|
if (len == -3)
|
||||||
key = TO_SPECIAL(string[1], string[2]);
|
key = TO_SPECIAL(string[1], string[2]);
|
||||||
else
|
else
|
||||||
key = string[0];
|
{
|
||||||
|
string[len] = NUL;
|
||||||
|
key = mb_ptr2char(string);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle modifiers.
|
// Handle modifiers.
|
||||||
modifiers = modifiers_gdk2vim(state);
|
modifiers = modifiers_gdk2vim(state);
|
||||||
@ -1240,8 +1243,7 @@ key_press_event(GtkWidget *widget UNUSED,
|
|||||||
// May remove the shift modifier if it's included in the key.
|
// May remove the shift modifier if it's included in the key.
|
||||||
modifiers = may_remove_shift_modifier(modifiers, key);
|
modifiers = may_remove_shift_modifier(modifiers, key);
|
||||||
|
|
||||||
string[0] = key;
|
len = mb_char2bytes(key, string);
|
||||||
len = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modifiers != 0)
|
if (modifiers != 0)
|
||||||
|
|||||||
@ -938,7 +938,10 @@ gui_x11_key_hit_cb(
|
|||||||
if (len == -3)
|
if (len == -3)
|
||||||
key = TO_SPECIAL(string[1], string[2]);
|
key = TO_SPECIAL(string[1], string[2]);
|
||||||
else
|
else
|
||||||
key = string[0];
|
{
|
||||||
|
string[len] = NUL;
|
||||||
|
key = mb_ptr2char(string);
|
||||||
|
}
|
||||||
key = simplify_key(key, &modifiers);
|
key = simplify_key(key, &modifiers);
|
||||||
if (key == CSI)
|
if (key == CSI)
|
||||||
key = K_CSI;
|
key = K_CSI;
|
||||||
@ -951,8 +954,7 @@ gui_x11_key_hit_cb(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string[0] = key;
|
len = mb_char2bytes(key, string);
|
||||||
len = 1;
|
|
||||||
|
|
||||||
// Remove the SHIFT modifier for keys where it's already included,
|
// Remove the SHIFT modifier for keys where it's already included,
|
||||||
// e.g., '(', '!' and '*'.
|
// e.g., '(', '!' and '*'.
|
||||||
|
|||||||
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1027,
|
||||||
/**/
|
/**/
|
||||||
1026,
|
1026,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user