mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4829: a key may be simplified to NUL
Problem: A key may be simplified to NUL.
Solution: Use K_ZERO instead. Use macros instead of hard coded values.
(closes vim/vim#10290)
17c95d9608
This commit is contained in:
parent
f2b512ad75
commit
bf065d9bb6
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
9
src/nvim/testdir/test_termcodes.vim
Normal file
9
src/nvim/testdir/test_termcodes.vim
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user