Patch 9.0.1414
Problem: <M-S-x> in Kitty does not use the Shift modifier.
Solution: Apply the Shift modifier to ASCII letters. (closes #11913)
Files: src/getchar.c
*** ../vim-9.0.1413/src/getchar.c 2023-03-07 21:04:58.329770231 +0000
--- src/getchar.c 2023-03-18 17:19:08.126946021 +0000
***************
*** 1623,1635 ****
/*
* Convert "c" plus "modifiers" to merge the effect of modifyOtherKeys into
the
! * character.
*/
int
merge_modifyOtherKeys(int c_arg, int *modifiers)
{
int c = c_arg;
if (*modifiers & MOD_MASK_CTRL)
{
if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_'))
--- 1623,1636 ----
/*
* Convert "c" plus "modifiers" to merge the effect of modifyOtherKeys into
the
! * character. Also for when the Kitty key protocol is used.
*/
int
merge_modifyOtherKeys(int c_arg, int *modifiers)
{
int c = c_arg;
+ // CTRL only uses the lower 5 bits of the character.
if (*modifiers & MOD_MASK_CTRL)
{
if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_'))
***************
*** 1658,1669 ****
--- 1659,1681 ----
if (c != c_arg)
*modifiers &= ~MOD_MASK_CTRL;
}
+
+ // Alt/Meta sets the 8th bit of the character.
if ((*modifiers & (MOD_MASK_META | MOD_MASK_ALT))
&& c >= 0 && c <= 127)
{
+ // Some terminals (esp. Kitty) do not include Shift in the character.
+ // Apply it here to get consistency across terminals. Only do ASCII
+ // letters, for other characters it depends on the keyboard layout.
+ if ((*modifiers & MOD_MASK_SHIFT) && c >= 'a' && c <= 'z')
+ {
+ c += 'a' - 'A';
+ *modifiers &= ~MOD_MASK_SHIFT;
+ }
c += 0x80;
*modifiers &= ~(MOD_MASK_META | MOD_MASK_ALT);
}
+
return c;
}
*** ../vim-9.0.1413/src/version.c 2023-03-17 18:50:45.210920685 +0000
--- src/version.c 2023-03-18 17:17:28.631119584 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1414,
/**/
--
>From "know your smileys":
(\___/)
(+'.'+) Bunny
(")_(")
/// 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/20230318172311.6B7DA1C135C%40moolenaar.net.