Skip to content

Commit

Permalink
fix(completion): prevent K_LUA from closing pum
Browse files Browse the repository at this point in the history
  • Loading branch information
zeertzjq committed Jan 10, 2022
1 parent 8f27c4a commit 42e5fd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvim/edit.c
Expand Up @@ -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;
}

Expand Down
10 changes: 10 additions & 0 deletions test/functional/api/keymap_spec.lua
Expand Up @@ -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
Expand Down

0 comments on commit 42e5fd3

Please sign in to comment.