diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/getchar.c | 4 | ||||
-rw-r--r-- | src/nvim/keymap.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_termcodes.vim | 9 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 2fe732d6f4..9826317102 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1450,7 +1450,7 @@ int merge_modifiers(int c_arg, int *modifiers) if (*modifiers & MOD_MASK_CTRL) { if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_')) { c &= 0x1f; - if (c == 0) { + if (c == NUL) { c = K_ZERO; } } else if (c == '6') { @@ -2738,7 +2738,7 @@ int inchar(char_u *buf, int maxlen, long wait_time) for (;;) { len = os_inchar(dum, DUM_LEN, 0L, 0, NULL); - if (len == 0 || (len == 1 && dum[0] == 3)) { + if (len == 0 || (len == 1 && dum[0] == Ctrl_C)) { break; } } diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 5c4fe13e39..db51237771 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -785,7 +785,7 @@ static int extract_modifiers(int key, int *modp, const bool simplify, bool *cons && ((key >= '?' && key <= '_') || ASCII_ISALPHA(key))) { key = CTRL_CHR(key); modifiers &= ~MOD_MASK_CTRL; - if (key == 0) { // <C-@> is <Nul> + if (key == NUL) { // <C-@> is <Nul> key = K_ZERO; } if (did_simplify != NULL) { diff --git a/src/nvim/testdir/test_termcodes.vim b/src/nvim/testdir/test_termcodes.vim new file mode 100644 index 0000000000..ecd408264d --- /dev/null +++ b/src/nvim/testdir/test_termcodes.vim @@ -0,0 +1,9 @@ + +func Test_simplify_ctrl_at() + " feeding unsimplified CTRL-@ should still trigger i_CTRL-@ + call feedkeys("ifoo\<Esc>A\<*C-@>", 'xt') + call assert_equal('foofoo', getline(1)) +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab |