diff options
author | ZyX <kp-pav@yandex.ru> | 2017-11-30 02:01:49 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-11-30 02:01:49 +0300 |
commit | de45ec0146486c49719ff6f6dcceb4914b471c7a (patch) | |
tree | efeca45f58023f8259511276815243539bffa1a1 /test | |
parent | 36a4f3a259ffa282129b18358cce4130397077c5 (diff) | |
download | rneovim-de45ec0146486c49719ff6f6dcceb4914b471c7a.tar.gz rneovim-de45ec0146486c49719ff6f6dcceb4914b471c7a.tar.bz2 rneovim-de45ec0146486c49719ff6f6dcceb4914b471c7a.zip |
keymap: Do not use vim_isIDc in keymap.c
Note: there are three changes to ascii_isident. Reverting first two (in
find_special_key and first in get_special_key_code) normally fails the new test
with empty &isident, but reverting the third does not. Hence adding `>` to
&isident.
Ref vim/vim#2389.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ex_cmds/map_spec.lua | 21 | ||||
-rw-r--r-- | test/symbolic/klee/nvim/charset.c | 5 | ||||
-rw-r--r-- | test/symbolic/klee/nvim/keymap.c | 7 |
3 files changed, 25 insertions, 8 deletions
diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua new file mode 100644 index 0000000000..b46f83405e --- /dev/null +++ b/test/functional/ex_cmds/map_spec.lua @@ -0,0 +1,21 @@ +local helpers = require("test.functional.helpers")(after_each) + +local eq = helpers.eq +local feed = helpers.feed +local meths = helpers.meths +local clear = helpers.clear +local command = helpers.command + +describe(':*map', function() + before_each(clear) + + it('are not affected by &isident', function() + meths.set_var('counter', 0) + command('nnoremap <C-x> :let counter+=1<CR>') + meths.set_option('isident', ('%u'):format(('>'):byte())) + command('nnoremap <C-y> :let counter+=1<CR>') + -- &isident used to disable keycode parsing here as well + feed('\24\25<C-x><C-y>') + eq(4, meths.get_var('counter')) + end) +end) diff --git a/test/symbolic/klee/nvim/charset.c b/test/symbolic/klee/nvim/charset.c index 77f690f08d..95853a6834 100644 --- a/test/symbolic/klee/nvim/charset.c +++ b/test/symbolic/klee/nvim/charset.c @@ -6,11 +6,6 @@ #include "nvim/eval/typval.h" #include "nvim/vim.h" -bool vim_isIDc(int c) -{ - return ASCII_ISALNUM(c); -} - int hex2nr(int c) { if ((c >= 'a') && (c <= 'f')) { diff --git a/test/symbolic/klee/nvim/keymap.c b/test/symbolic/klee/nvim/keymap.c index ff5e46e75b..a341a73689 100644 --- a/test/symbolic/klee/nvim/keymap.c +++ b/test/symbolic/klee/nvim/keymap.c @@ -2,6 +2,7 @@ #include "nvim/types.h" #include "nvim/keymap.h" +#include "nvim/ascii.h" #include "nvim/eval/typval.h" #define MOD_KEYS_ENTRY_SIZE 5 @@ -294,12 +295,12 @@ int get_special_key_code(const char_u *name) for (int i = 0; key_names_table[i].name != NULL; i++) { const char *const table_name = key_names_table[i].name; int j; - for (j = 0; vim_isIDc(name[j]) && table_name[j] != NUL; j++) { + for (j = 0; ascii_isident(name[j]) && table_name[j] != NUL; j++) { if (TOLOWER_ASC(table_name[j]) != TOLOWER_ASC(name[j])) { break; } } - if (!vim_isIDc(name[j]) && table_name[j] == NUL) { + if (!ascii_isident(name[j]) && table_name[j] == NUL) { return key_names_table[i].key; } } @@ -386,7 +387,7 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp, // Find end of modifier list last_dash = src; - for (bp = src + 1; bp <= end && (*bp == '-' || vim_isIDc(*bp)); bp++) { + for (bp = src + 1; bp <= end && (*bp == '-' || ascii_isident(*bp)); bp++) { if (*bp == '-') { last_dash = bp; if (bp + 1 <= end) { |