Patch 9.0.1414

4 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 18, 2023, 1:23:16 PM3/18/23
to vim...@googlegroups.com

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 -- 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