]> granicus.if.org Git - vim/commitdiff
patch 9.0.1302: on a Belgian keyboard CTRL-] does not work v9.0.1302
authorBram Moolenaar <Bram@vim.org>
Sat, 11 Feb 2023 16:15:50 +0000 (16:15 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 11 Feb 2023 16:15:50 +0000 (16:15 +0000)
Problem:    On a Belgian keyboard CTRL-] does not work.
Solution:   Translate CTRL-$ into CTRL-]. (closes #11831)

src/gui_x11.c
src/misc2.c
src/version.c

index 540f143e2ad5d1dae052b73fbc7064e23d88c148..fc63658f8d7c881202f7528dc7555612ba887f89 100644 (file)
@@ -936,11 +936,11 @@ gui_x11_key_hit_cb(
     }
     else
     {
-       len = mb_char2bytes(key, string);
-
        // Some keys need adjustment when the Ctrl modifier is used.
        key = may_adjust_key_for_ctrl(modifiers, key);
 
+       len = mb_char2bytes(key, string);
+
        // Remove the SHIFT modifier for keys where it's already included,
        // e.g., '(', '!' and '*'.
        modifiers = may_remove_shift_modifier(modifiers, key);
index e3602ee4b80b87782dc6745621f1de1bbb89d127..6133a5e93b26e4243d3217b00fb745dee04dbd1a 100644 (file)
@@ -1543,7 +1543,7 @@ find_special_key(
     int
 may_adjust_key_for_ctrl(int modifiers, int key)
 {
-    if (!(modifiers & MOD_MASK_CTRL))
+    if ((modifiers & MOD_MASK_CTRL) == 0)
        return key;
 
     if (ASCII_ISALPHA(key))
@@ -1559,6 +1559,13 @@ may_adjust_key_for_ctrl(int modifiers, int key)
        return '^';
     if (key == '-')
        return '_';
+
+    // On a Belgian keyboard AltGr $ is ']', on other keyboards '$' can only be
+    // obtained with Shift.  Assume that '$' without shift implies a Belgian
+    // keyboard, where CTRL-$ means CTRL-].
+    if (key == '$' && (modifiers & MOD_MASK_SHIFT) == 0)
+       return ']';
+
     return key;
 }
 
index 524abf792ff9c5b0a738a9071d8981c4905aa24b..058c712eba0b2abb12f77154d165d80397b3cc88 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1302,
 /**/
     1301,
 /**/