Skip to content

Commit 4dd9252

Browse files
haron13-2019brammool
authored andcommitted
patch 9.0.0033: on a Belgian keyboard CTRL-[ does not work
Problem: On a Belgian keyboard CTRL-[ does not work. Solution: Handle GDK_KEY_dead_circumflex. (Anton Sharonov, closes #10658)
1 parent 7fe956d commit 4dd9252

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/gui_gtk_x11.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ key_press_event(GtkWidget *widget UNUSED,
11601160
int key;
11611161
guint state;
11621162
char_u *s, *d;
1163+
int ctrl_prefix_added = 0;
11631164

11641165
gui.event_time = event->time;
11651166
key_sym = event->keyval;
@@ -1245,6 +1246,20 @@ key_press_event(GtkWidget *widget UNUSED,
12451246
}
12461247
}
12471248

1249+
// Belgian Ctrl+[ workaround
1250+
if (len == 0 && key_sym == GDK_KEY_dead_circumflex)
1251+
{
1252+
string[0] = CSI;
1253+
string[1] = KS_MODIFIER;
1254+
string[2] = MOD_MASK_CTRL;
1255+
string[3] = '[';
1256+
len = 4;
1257+
add_to_input_buf(string, len);
1258+
// workaround has to return here, otherwise our fake string[] entries
1259+
// are confusing code downstream
1260+
return TRUE;
1261+
}
1262+
12481263
if (len == 0) // Unrecognized key
12491264
return TRUE;
12501265

@@ -1288,6 +1303,8 @@ key_press_event(GtkWidget *widget UNUSED,
12881303
string2[1] = KS_MODIFIER;
12891304
string2[2] = modifiers;
12901305
add_to_input_buf(string2, 3);
1306+
if (modifiers == 0x4)
1307+
ctrl_prefix_added = 1;
12911308
}
12921309

12931310
// Check if the key interrupts.
@@ -1302,6 +1319,15 @@ key_press_event(GtkWidget *widget UNUSED,
13021319
}
13031320
}
13041321

1322+
// workaround for German keyboard, where instead of '[' char we have code
1323+
// sequence of bytes 195, 188 (UTF-8 for "u-umlaut")
1324+
if (ctrl_prefix_added && len == 2
1325+
&& ((int)string[0]) == 195
1326+
&& ((int)string[1]) == 188)
1327+
{
1328+
string[0] = 91; // ASCII('[')
1329+
len = 1;
1330+
}
13051331
add_to_input_buf(string, len);
13061332

13071333
// blank out the pointer if necessary

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
33,
738740
/**/
739741
32,
740742
/**/

0 commit comments

Comments
 (0)