diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 2 | ||||
-rw-r--r-- | src/nvim/autocmd.c | 2 | ||||
-rw-r--r-- | src/nvim/eval/typval.c | 21 | ||||
-rw-r--r-- | src/nvim/getchar.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/test_mapping.vim | 30 |
5 files changed, 35 insertions, 27 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 9d0b096a36..c37df45c14 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1991,7 +1991,7 @@ Array nvim_get_proc_children(Integer pid, Error *err) size_t proc_count; int rv = os_proc_children((int)pid, &proc_list, &proc_count); - if (rv != 0) { + if (rv == 2) { // syscall failed (possibly because of kernel options), try shelling out. DLOG("fallback to vim._os_proc_children()"); Array a = ARRAY_DICT_INIT; diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index a36d61420a..e7e1d5fd1b 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -2473,7 +2473,7 @@ bool aucmd_exec_is_deleted(AucmdExecutable acc) case CALLABLE_EX: return acc.callable.cmd == NULL; case CALLABLE_CB: - return callback_is_freed(acc.callable.cb); + return acc.callable.cb.type == kCallbackNone; case CALLABLE_NONE: return true; } diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 44b003d106..d492c67877 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1155,27 +1155,6 @@ void callback_free(Callback *callback) callback->data.funcref = NULL; } -/// Check if callback is freed -bool callback_is_freed(Callback callback) -{ - switch (callback.type) { - case kCallbackFuncref: - return false; - break; - case kCallbackPartial: - return false; - break; - case kCallbackLua: - return callback.data.luaref == LUA_NOREF; - break; - case kCallbackNone: - return true; - break; - } - - return true; -} - /// Copy a callback into a typval_T. void callback_put(Callback *cb, typval_T *tv) FUNC_ATTR_NONNULL_ALL diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 85a5c176bb..8426cdb98c 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1712,11 +1712,10 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth) int local_State = get_real_state(); bool is_plug_map = false; - // Check if typehead starts with a <Plug> mapping. - // In that case we will ignore nore flag on it. + // If typehead starts with <Plug> then remap, even for a "noremap" mapping. if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL - && typebuf.tb_buf[typebuf.tb_off+1] == KS_EXTRA - && typebuf.tb_buf[typebuf.tb_off+2] == KE_PLUG) { + && typebuf.tb_buf[typebuf.tb_off + 1] == KS_EXTRA + && typebuf.tb_buf[typebuf.tb_off + 2] == KE_PLUG) { is_plug_map = true; } diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 1080a3c85b..98440ccdd7 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -646,4 +646,34 @@ func Test_abbreviate_multi_byte() bwipe! endfunc +" Test for <Plug> always being mapped, even when used with "noremap". +func Test_plug_remap() + let g:foo = 0 + nnoremap <Plug>(Increase_x) <Cmd>let g:foo += 1<CR> + nmap <F2> <Plug>(Increase_x) + nnoremap <F3> <Plug>(Increase_x) + call feedkeys("\<F2>", 'xt') + call assert_equal(1, g:foo) + call feedkeys("\<F3>", 'xt') + call assert_equal(2, g:foo) + nnoremap x <Nop> + nmap <F4> x<Plug>(Increase_x)x + nnoremap <F5> x<Plug>(Increase_x)x + call setline(1, 'Some text') + normal! gg$ + call feedkeys("\<F4>", 'xt') + call assert_equal(3, g:foo) + call assert_equal('Some text', getline(1)) + call feedkeys("\<F5>", 'xt') + call assert_equal(4, g:foo) + call assert_equal('Some te', getline(1)) + nunmap <Plug>(Increase_x) + nunmap <F2> + nunmap <F3> + nunmap <F4> + nunmap <F5> + unlet g:foo + %bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |