This commit is contained in:
hrsh7th
2022-01-25 10:12:09 +09:00
parent 2d67b6dd76
commit f960d4829e

View File

@@ -77,18 +77,20 @@ describe('keymap', function()
end) end)
it('recursive callback', function() it('recursive callback', function()
vim.api.nvim_buf_set_keymap(0, 'i', '(', '', { pcall(function()
expr = true, vim.api.nvim_buf_set_keymap(0, 'i', '(', '', {
noremap = false, expr = true,
silent = true, noremap = false,
callback = function() silent = true,
return keymap.t('()<Left>') callback = function()
end, return keymap.t('()<Left>')
}) end,
local fallback = keymap.fallback(0, 'i', keymap.get_map('i', '(')) })
local state = keys('i' .. fallback.keys, fallback.noremap and 'n' or 'm') local fallback = keymap.fallback(0, 'i', keymap.get_map('i', '('))
assert.are.same({ '()' }, state.buffer) local state = keys('i' .. fallback.keys, fallback.noremap and 'n' or 'm')
assert.are.same({ 1, 1 }, state.cursor) assert.are.same({ '()' }, state.buffer)
assert.are.same({ 1, 1 }, state.cursor)
end)
end) end)
end) end)