Patch 8.2.1752

5 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 27, 2020, 7:17:38 AM9/27/20
to vim...@googlegroups.com

Patch 8.2.1752
Problem: GTK GUI: cannot map alt-? with <A-?>. (Ingo Karkat)
Solution: Adjust the characters for which the shift modifier is removed.
(closes #7016) Make Motif and Win32 use the same function as GTK.
Files: src/misc2.c, src/gui_x11.c, src/gui_w32.c,
src/testdir/test_termcodes.vim


*** ../vim-8.2.1751/src/misc2.c 2020-08-11 21:58:12.581968226 +0200
--- src/misc2.c 2020-09-27 13:13:22.113979451 +0200
***************
*** 2950,2955 ****
--- 2950,2956 ----
* Some keys already have Shift included, pass them as normal keys.
* Not when Ctrl is also used, because <C-H> and <C-S-H> are different.
* Also for <A-S-a> and <M-S-a>.
+ * This includes all printable ASCII characters except numbers and a-z.
*/
int
may_remove_shift_modifier(int modifiers, int key)
***************
*** 2957,2964 ****
if ((modifiers == MOD_MASK_SHIFT
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_ALT)
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_META))
! && ((key >= '@' && key <= 'Z')
! || key == '^' || key == '_'
|| (key >= '{' && key <= '~')))
return modifiers & ~MOD_MASK_SHIFT;
return modifiers;
--- 2958,2966 ----
if ((modifiers == MOD_MASK_SHIFT
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_ALT)
|| modifiers == (MOD_MASK_SHIFT | MOD_MASK_META))
! && ((key >= '!' && key <= '/')
! || (key >= ':' && key <= 'Z')
! || (key >= '[' && key <= '`')
|| (key >= '{' && key <= '~')))
return modifiers & ~MOD_MASK_SHIFT;
return modifiers;
*** ../vim-8.2.1751/src/gui_x11.c 2020-08-01 13:10:04.582539553 +0200
--- src/gui_x11.c 2020-09-27 13:14:09.217862894 +0200
***************
*** 958,965 ****

// Remove the SHIFT modifier for keys where it's already included,
// e.g., '(', '!' and '*'.
! if (!ASCII_ISALPHA(key) && key > 0x20 && key < 0x7f)
! modifiers &= ~MOD_MASK_SHIFT;
}

if (modifiers != 0)
--- 958,964 ----

// Remove the SHIFT modifier for keys where it's already included,
// e.g., '(', '!' and '*'.
! modifiers = may_remove_shift_modifier(modifiers, key);
}

if (modifiers != 0)
*** ../vim-8.2.1751/src/gui_w32.c 2020-07-17 22:26:49.768820207 +0200
--- src/gui_w32.c 2020-09-26 23:10:20.642511519 +0200
***************
*** 842,849 ****
ch = simplify_key(ch, &modifiers);
// remove the SHIFT modifier for keys where it's already included, e.g.,
// '(' and '*'
! if (ch < 0x100 && !isalpha(ch) && isprint(ch))
! modifiers &= ~MOD_MASK_SHIFT;

// Unify modifiers somewhat. No longer use ALT to set the 8th bit.
ch = extract_modifiers(ch, &modifiers, FALSE, NULL);
--- 842,848 ----
ch = simplify_key(ch, &modifiers);
// remove the SHIFT modifier for keys where it's already included, e.g.,
// '(' and '*'
! modifiers = may_remove_shift_modifier(modifiers, ch);

// Unify modifiers somewhat. No longer use ALT to set the 8th bit.
ch = extract_modifiers(ch, &modifiers, FALSE, NULL);
*** ../vim-8.2.1751/src/testdir/test_termcodes.vim 2020-08-20 18:59:02.106779176 +0200
--- src/testdir/test_termcodes.vim 2020-09-27 13:06:08.506835801 +0200
***************
*** 2123,2128 ****
--- 2123,2142 ----
call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'S-A', 4)
endfunc

+ func Test_mapping_works_with_alt_and_shift()
+ new
+ set timeoutlen=10
+
+ " mapping <A-?> works even though the code is A-S-?
+ for c in ['!', '$', '+', ':', '?', '^', '~']
+ call RunTest_mapping_mods('<A-' .. c .. '>', c, function('GetEscCodeCSI27'), 4)
+ call RunTest_mapping_mods('<A-' .. c .. '>', c, function('GetEscCodeCSIu'), 4)
+ endfor
+
+ bwipe!
+ set timeoutlen&
+ endfunc
+
func Test_mapping_works_with_ctrl_alt()
call RunTest_mapping_works_with_mods(function('GetEscCodeCSI27'), 'C-A', 7)
call RunTest_mapping_works_with_mods(function('GetEscCodeCSIu'), 'C-A', 7)
*** ../vim-8.2.1751/src/version.c 2020-09-26 22:39:18.427725844 +0200
--- src/version.c 2020-09-26 23:02:26.039715328 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1752,
/**/

--
The process for understanding customers primarily involves sitting around with
other marketing people and talking about what you would to if you were dumb
enough to be a customer.
(Scott Adams - The Dilbert principle)

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