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;
+ 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);
// 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;
+ modifiers = may_remove_shift_modifier(modifiers, key);
}
if (modifiers != 0)
* 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)
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 <= '/')
+ || (key >= ':' && key <= 'Z')
+ || (key >= '[' && key <= '`')
|| (key >= '{' && key <= '~')))
return modifiers & ~MOD_MASK_SHIFT;
return modifiers;
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)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1752,
/**/
1751,
/**/