fix(completion): prevent K_LUA from closing pum

This commit is contained in:
zeertzjq 2022-01-10 20:03:34 +08:00
parent 8f27c4a041
commit 42e5fd32b0
2 changed files with 11 additions and 1 deletions

View File

@ -3620,7 +3620,7 @@ static bool ins_compl_prep(int c)
// Ignore end of Select mode mapping and mouse scroll buttons.
if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP
|| c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_EVENT
|| c == K_COMMAND) {
|| c == K_COMMAND || c == K_LUA) {
return retval;
}

View File

@ -820,6 +820,16 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
eq(99, exec_lua[[return SomeValue]])
end)
it('does not reset pum in lua mapping', function()
eq(0, exec_lua [[
VisibleCount = 0
vim.api.nvim_set_keymap ('i', '<F2>', '', {callback = function() VisibleCount = VisibleCount + vim.fn.pumvisible() end})
return VisibleCount
]])
feed('i<C-X><C-V><F2><F2><esc>')
eq(2, exec_lua[[return VisibleCount]])
end)
it('can overwrite lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0