Patch 9.0.0686

5 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 7, 2022, 11:29:31 AM10/7/22
to vim...@googlegroups.com

Patch 9.0.0686
Problem: The right ALT key does not work on some MS-Windows keyboards.
Solution: Adjust the modifiers based on GetKeyState(). (Anoton Sharonov,
closes #11300)
Files: src/gui_w32.c


*** ../vim-9.0.0685/src/gui_w32.c 2022-10-04 16:23:39.014042183 +0100
--- src/gui_w32.c 2022-10-07 16:27:56.098298182 +0100
***************
*** 852,857 ****
--- 852,864 ----
modifiers |= MOD_MASK_ALT;
if ((modifiers & MOD_MASK_CTRL) && (GetKeyState(VK_RMENU) & 0x8000))
modifiers &= ~MOD_MASK_CTRL;
+ // Add RightALT only if it is hold alone (without Ctrl), because if AltGr
+ // is pressed, Windows claims that Ctrl is hold as well. That way we can
+ // recognize Right-ALT alone and be sure that not AltGr is hold.
+ if (!(GetKeyState(VK_CONTROL) & 0x8000)
+ && (GetKeyState(VK_RMENU) & 0x8000)
+ && !(GetKeyState(VK_LMENU) & 0x8000)) // seems AltGr has both set
+ modifiers |= MOD_MASK_ALT;

return modifiers;
}
*** ../vim-9.0.0685/src/version.c 2022-10-07 16:00:00.757126668 +0100
--- src/version.c 2022-10-07 16:28:23.034274878 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 686,
/**/

--
"Never be afraid to tell the world who you are."
-- Anonymous

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages