]> granicus.if.org Git - vim/commitdiff
patch 8.2.5159: fix for CTRL-key combinations causes problems v8.2.5159
authorBram Moolenaar <Bram@vim.org>
Sat, 25 Jun 2022 12:48:25 +0000 (13:48 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 25 Jun 2022 12:48:25 +0000 (13:48 +0100)
Problem:    Fix for CTRL-key combinations causes more problems than it solves.
Solution:   Roll back the change.

src/gui_w32.c
src/version.c

index ae419053b2f5e17110293b61a7cbcaa656a49035..7bdbf418da29f5fd3253be3861f05d922100b7f1 100644 (file)
@@ -2055,21 +2055,21 @@ process_message(void)
            int         i;
            UINT        scan_code;
 
-           // Construct the keyboard state table, the modifiers can and will
-           // affect the character translation performed by ToUnicode.
-           // Eg. With a Russian keyboard layout pressing 'n' produces 'т' but
-           // Ctrl+p produces 'p', this is essential for the keybindings to
-           // work.
+           // Construct the state table with only a few modifiers, we don't
+           // really care about the presence of Ctrl/Alt as those modifiers are
+           // handled by Vim separately.
            memset(keyboard_state, 0, 256);
-           if (GetKeyState(VK_CONTROL) & 0x8000)
-               keyboard_state[VK_CONTROL] = 0x80;
            if (GetKeyState(VK_SHIFT) & 0x8000)
                keyboard_state[VK_SHIFT] = 0x80;
            if (GetKeyState(VK_CAPITAL) & 0x0001)
                keyboard_state[VK_CAPITAL] = 0x01;
-           // Alt-Gr is synthesized as (Right)Alt + Ctrl.
-           if ((GetKeyState(VK_RMENU) & 0x8000) && keyboard_state[VK_CONTROL])
+           // Alt-Gr is synthesized as Alt + Ctrl.
+           if ((GetKeyState(VK_RMENU) & 0x8000)
+                                        && (GetKeyState(VK_CONTROL) & 0x8000))
+           {
                keyboard_state[VK_MENU] = 0x80;
+               keyboard_state[VK_CONTROL] = 0x80;
+           }
 
            // Translate the virtual key according to the current keyboard
            // layout.
@@ -2079,16 +2079,6 @@ process_message(void)
            // If this is a dead key ToUnicode returns a negative value.
            len = ToUnicode(vk, scan_code, keyboard_state, ch, ARRAY_LENGTH(ch),
                    0);
-           if (len == 0 && keyboard_state[VK_CONTROL])
-           {
-               // Handle one more special case: pressing Ctrl+key may
-               // generate an unprintable ASCII character, try again without
-               // the modifier to get the pressed key value.
-               keyboard_state[VK_CONTROL] = 0;
-               len = ToUnicode(vk, scan_code, keyboard_state, ch,
-                       ARRAY_LENGTH(ch), 0);
-               keyboard_state[VK_CONTROL] = 0x80;
-           }
            dead_key = len < 0;
 
            if (len <= 0)
index 8638e9e37feab1b5f1a810210769dc0692a35b72..e0a9768de181bdeb38aa42edbff8b710065dfed1 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5159,
 /**/
     5158,
 /**/