To: vim_dev@googlegroups.com Subject: Patch 9.0.0686 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@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 ///