aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-09 13:31:42 +0800
committerGitHub <noreply@github.com>2022-04-09 13:31:42 +0800
commitfda9adab5d0688fbd94544dc7146d0957c728c69 (patch)
tree6a340fc63425a5023e5eb633118102bf68e0e0d6 /src/nvim/getchar.c
parent012c055804876346a3ef5c1d0cdb8e0a7ee58481 (diff)
downloadrneovim-fda9adab5d0688fbd94544dc7146d0957c728c69.tar.gz
rneovim-fda9adab5d0688fbd94544dc7146d0957c728c69.tar.bz2
rneovim-fda9adab5d0688fbd94544dc7146d0957c728c69.zip
vim-patch:partial:8.1.2333: with modifyOtherKeys CTRL-^ doesn't work (#18048)
Problem: With modifyOtherKeys CTRL-^ doesn't work. Solution: Handle the exception. https://github.com/vim/vim/commit/828ffd596394f714270a01a55fc3f949a8bd9b35
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 299385cb17..d615255828 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1590,11 +1590,19 @@ int vgetc(void)
c = utf_ptr2char(buf);
}
- if ((mod_mask & MOD_MASK_CTRL) && (c >= '?' && c <= '_')) {
- c = Ctrl_chr(c);
- mod_mask &= ~MOD_MASK_CTRL;
- if (c == 0) { // <C-@> is <Nul>
- c = K_ZERO;
+ // A modifier was not used for a mapping, apply it to ASCII
+ // keys. Shift would already have been applied.
+ if (mod_mask & MOD_MASK_CTRL) {
+ if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_')) {
+ c &= 0x1f;
+ mod_mask &= ~MOD_MASK_CTRL;
+ if (c == 0) {
+ c = K_ZERO;
+ }
+ } else if (c == '6') {
+ // CTRL-6 is equivalent to CTRL-^
+ c = 0x1e;
+ mod_mask &= ~MOD_MASK_CTRL;
}
}