Mercurial > vim
comparison src/misc2.c @ 22526:6325ef9143bc
patch 8.2.1811: mapping Ctrl-key does not work for '{', '}' and '|'
Commit: https://github.com/vim/vim/commit/9a033d7b18651acbb7eda4b7f39a27c01748fb70
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 7 17:29:48 2020 +0200
patch 8.2.1811: mapping Ctrl-key does not work for '{', '}' and '|'
Problem: Mapping Ctrl-key does not work for '{', '}' and '|'.
Solution: Remove the shift modifier. (closes https://github.com/vim/vim/issues/6457)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 07 Oct 2020 17:30:03 +0200 |
parents | 6c7e4db139a3 |
children | 4c21a3a47707 |
comparison
equal
deleted
inserted
replaced
22525:12f44f93c583 | 22526:6325ef9143bc |
---|---|
2972 return key; | 2972 return key; |
2973 } | 2973 } |
2974 | 2974 |
2975 /* | 2975 /* |
2976 * Some keys already have Shift included, pass them as normal keys. | 2976 * Some keys already have Shift included, pass them as normal keys. |
2977 * Not when Ctrl is also used, because <C-H> and <C-S-H> are different. | 2977 * When Ctrl is also used <C-H> and <C-S-H> are different, but <C-S-{> should |
2978 * be <C-{>. Same for <C-S-}> and <C-S-|>. | |
2978 * Also for <A-S-a> and <M-S-a>. | 2979 * Also for <A-S-a> and <M-S-a>. |
2979 * This includes all printable ASCII characters except numbers and a-z. | 2980 * This includes all printable ASCII characters except numbers and a-z. |
2980 */ | 2981 */ |
2981 int | 2982 int |
2982 may_remove_shift_modifier(int modifiers, int key) | 2983 may_remove_shift_modifier(int modifiers, int key) |
2987 && ((key >= '!' && key <= '/') | 2988 && ((key >= '!' && key <= '/') |
2988 || (key >= ':' && key <= 'Z') | 2989 || (key >= ':' && key <= 'Z') |
2989 || (key >= '[' && key <= '`') | 2990 || (key >= '[' && key <= '`') |
2990 || (key >= '{' && key <= '~'))) | 2991 || (key >= '{' && key <= '~'))) |
2991 return modifiers & ~MOD_MASK_SHIFT; | 2992 return modifiers & ~MOD_MASK_SHIFT; |
2993 | |
2994 if (modifiers == (MOD_MASK_SHIFT | MOD_MASK_CTRL) | |
2995 && (key == '{' || key == '}' || key == '|')) | |
2996 return modifiers & ~MOD_MASK_SHIFT; | |
2997 | |
2992 return modifiers; | 2998 return modifiers; |
2993 } | 2999 } |
2994 | 3000 |
2995 /* | 3001 /* |
2996 * Try to include modifiers in the key. | 3002 * Try to include modifiers in the key. |