1
0
forked from aniani/vim

patch 9.0.1169: some key+modifier tests fail on some AppVeyor images

Problem:    Some key+modifier tests fail on some AppVeyor images.
Solution:   Adjust the tests for key movements and fix the revealed bugs.
            (Christopher Plewright, closes #11798)
This commit is contained in:
Christopher Plewright
2023-01-10 13:43:04 +00:00
committed by Bram Moolenaar
parent 06cd14d0bf
commit 566f76e656
4 changed files with 193 additions and 202 deletions

View File

@@ -1043,7 +1043,7 @@ win32_kbd_patch_key(
}
// check if it already has a valid unicode character.
if (pker->uChar.UnicodeChar > 0 && pker->uChar.UnicodeChar < 0xFFFD)
if (pker->uChar.UnicodeChar != 0)
return 1;
CLEAR_FIELD(abKeystate);
@@ -1154,12 +1154,9 @@ decode_key_event(
else if (pker->wVirtualKeyCode >= VK_END
&& pker->wVirtualKeyCode <= VK_DOWN)
{
// VK_END 0x23
// VK_HOME 0x24
// VK_LEFT 0x25
// VK_UP 0x26
// VK_RIGHT 0x27
// VK_DOWN 0x28
// (0x23 - 0x28): VK_END, VK_HOME,
// VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN
*pmodifiers = 0;
*pch2 = VirtKeyMap[i].chAlone;
if ((nModifs & SHIFT) != 0
@@ -1167,7 +1164,7 @@ decode_key_event(
{
*pch2 = VirtKeyMap[i].chShift;
}
else if ((nModifs & CTRL) != 0
if ((nModifs & CTRL) != 0
&& (nModifs & ~CTRL) == 0)
{
*pch2 = VirtKeyMap[i].chCtrl;
@@ -1178,17 +1175,38 @@ decode_key_event(
*pch2 = VirtKeyMap[i].chAlone;
}
}
else if ((nModifs & ALT) != 0
&& (nModifs & ~ALT) == 0)
{
*pch2 = VirtKeyMap[i].chAlt;
}
else if ((nModifs & SHIFT) != 0
if ((nModifs & SHIFT) != 0
&& (nModifs & CTRL) != 0)
{
*pmodifiers |= MOD_MASK_CTRL;
*pch2 = VirtKeyMap[i].chShift;
}
if ((nModifs & ALT) != 0)
{
*pch2 = VirtKeyMap[i].chAlt;
*pmodifiers |= MOD_MASK_ALT;
if ((nModifs & ~ALT) == 0)
{
*pch2 = VirtKeyMap[i].chAlone;
}
else if ((nModifs & SHIFT) != 0)
{
*pch2 = VirtKeyMap[i].chShift;
}
else if ((nModifs & CTRL) != 0)
{
if (pker->wVirtualKeyCode == VK_UP
|| pker->wVirtualKeyCode == VK_DOWN)
{
*pmodifiers |= MOD_MASK_CTRL;
*pch2 = VirtKeyMap[i].chAlone;
}
else
{
*pch2 = VirtKeyMap[i].chCtrl;
}
}
}
}
else
{
@@ -1319,7 +1337,7 @@ encode_key_event(dict_T *args, INPUT_RECORD *ir)
}
ker.dwControlKeyState |= s_dwMods;
ker.wVirtualKeyCode = vkCode;
ker.uChar.UnicodeChar = 0xFFFD; // UNICODE REPLACEMENT CHARACTER
ker.uChar.UnicodeChar = 0;
ir->Event.KeyEvent = ker;
vim_free(action);
}