diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-05-16 18:57:53 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-05-16 18:57:53 +0200 |
commit | aa5fc4ec51b00e91f174ac83c8ff68becf5f42bb (patch) | |
tree | b674997236b0f56a9d70fa4f01ec6c612db46549 | |
parent | 129d6bf6b3d120b0a4c69e18b5e8602a84e352bf (diff) | |
download | vim-git-aa5fc4ec51b00e91f174ac83c8ff68becf5f42bb.tar.gz |
patch 8.2.0770: cannot map CTRL-B when using the GUIv8.2.0770
Problem: Cannot map CTRL-B when using the GUI.
Solution: Reset the CTRL modifier when used. (closes #6092)
-rw-r--r-- | src/gui_gtk_x11.c | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 02526b272..8e272970d 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -1023,7 +1023,7 @@ focus_out_event(GtkWidget *widget UNUSED, * http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventKey */ static int -keyval_to_string(unsigned int keyval, unsigned int state, char_u *string) +keyval_to_string(unsigned int keyval, unsigned int *state, char_u *string) { int len; guint32 uc; @@ -1031,8 +1031,8 @@ keyval_to_string(unsigned int keyval, unsigned int state, char_u *string) uc = gdk_keyval_to_unicode(keyval); if (uc != 0) { - // Check for CTRL-foo - if ((state & GDK_CONTROL_MASK) && uc >= 0x20 && uc < 0x80) + // Check for CTRL-char + if ((*state & GDK_CONTROL_MASK) && uc >= 0x20 && uc < 0x80) { // These mappings look arbitrary at the first glance, but in fact // resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my @@ -1051,6 +1051,10 @@ keyval_to_string(unsigned int keyval, unsigned int state, char_u *string) else string[0] = uc; len = 1; + + if (string[0] != uc) + // The modifier was used, remove it. + *state = *state & ~GDK_CONTROL_MASK; } else { @@ -1169,7 +1173,7 @@ key_press_event(GtkWidget *widget UNUSED, else #endif { - len = keyval_to_string(key_sym, state, string2); + len = keyval_to_string(key_sym, &state, string2); // Careful: convert_input() doesn't handle the NUL character. // No need to convert pure ASCII anyway, thus the len > 1 check. diff --git a/src/version.c b/src/version.c index a1b038f15..277650488 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 770, +/**/ 769, /**/ 768, |