Skip to content

Commit 7bb6d56

Browse files
committed
patch 8.2.5159: fix for CTRL-key combinations causes problems
Problem: Fix for CTRL-key combinations causes more problems than it solves. Solution: Roll back the change.
1 parent 61e3784 commit 7bb6d56

2 files changed

Lines changed: 11 additions & 19 deletions

File tree

src/gui_w32.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,21 +2055,21 @@ process_message(void)
20552055
int i;
20562056
UINT scan_code;
20572057

2058-
// Construct the keyboard state table, the modifiers can and will
2059-
// affect the character translation performed by ToUnicode.
2060-
// Eg. With a Russian keyboard layout pressing 'n' produces 'т' but
2061-
// Ctrl+p produces 'p', this is essential for the keybindings to
2062-
// work.
2058+
// Construct the state table with only a few modifiers, we don't
2059+
// really care about the presence of Ctrl/Alt as those modifiers are
2060+
// handled by Vim separately.
20632061
memset(keyboard_state, 0, 256);
2064-
if (GetKeyState(VK_CONTROL) & 0x8000)
2065-
keyboard_state[VK_CONTROL] = 0x80;
20662062
if (GetKeyState(VK_SHIFT) & 0x8000)
20672063
keyboard_state[VK_SHIFT] = 0x80;
20682064
if (GetKeyState(VK_CAPITAL) & 0x0001)
20692065
keyboard_state[VK_CAPITAL] = 0x01;
2070-
// Alt-Gr is synthesized as (Right)Alt + Ctrl.
2071-
if ((GetKeyState(VK_RMENU) & 0x8000) && keyboard_state[VK_CONTROL])
2066+
// Alt-Gr is synthesized as Alt + Ctrl.
2067+
if ((GetKeyState(VK_RMENU) & 0x8000)
2068+
&& (GetKeyState(VK_CONTROL) & 0x8000))
2069+
{
20722070
keyboard_state[VK_MENU] = 0x80;
2071+
keyboard_state[VK_CONTROL] = 0x80;
2072+
}
20732073

20742074
// Translate the virtual key according to the current keyboard
20752075
// layout.
@@ -2079,16 +2079,6 @@ process_message(void)
20792079
// If this is a dead key ToUnicode returns a negative value.
20802080
len = ToUnicode(vk, scan_code, keyboard_state, ch, ARRAY_LENGTH(ch),
20812081
0);
2082-
if (len == 0 && keyboard_state[VK_CONTROL])
2083-
{
2084-
// Handle one more special case: pressing Ctrl+key may
2085-
// generate an unprintable ASCII character, try again without
2086-
// the modifier to get the pressed key value.
2087-
keyboard_state[VK_CONTROL] = 0;
2088-
len = ToUnicode(vk, scan_code, keyboard_state, ch,
2089-
ARRAY_LENGTH(ch), 0);
2090-
keyboard_state[VK_CONTROL] = 0x80;
2091-
}
20922082
dead_key = len < 0;
20932083

20942084
if (len <= 0)

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+
5159,
738740
/**/
739741
5158,
740742
/**/

0 commit comments

Comments
 (0)