Patch 8.2.5157
Problem: MS-Windows GUI: CTRL-key combinations do not always work.
Solution: Handle special key combinations better. (closes #10613,
closes #10602, closes #10579)
Files: src/gui_w32.c
*** ../vim-8.2.5156/src/gui_w32.c 2022-06-11 10:43:16.569008231 +0100
--- src/gui_w32.c 2022-06-24 20:16:21.074586113 +0100
***************
*** 2055,2075 ****
int i;
UINT scan_code;
! // 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_SHIFT) & 0x8000)
keyboard_state[VK_SHIFT] = 0x80;
if (GetKeyState(VK_CAPITAL) & 0x0001)
keyboard_state[VK_CAPITAL] = 0x01;
! // 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.
--- 2055,2075 ----
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.
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])
keyboard_state[VK_MENU] = 0x80;
// Translate the virtual key according to the current keyboard
// layout.
***************
*** 2079,2084 ****
--- 2079,2094 ----
// 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)
*** ../vim-8.2.5156/src/version.c 2022-06-24 20:11:54.731272585 +0100
--- src/version.c 2022-06-24 20:16:13.798604319 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 5157,
/**/
--
I used to be indecisive, now I'm not sure.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220624191841.637771C099F%40moolenaar.net.