diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-16 18:51:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 18:51:36 +0800 |
commit | 179faa3edd6120a483b55aadf0a367fbf07b25fd (patch) | |
tree | 84ba1945cae3d370bfde437179ece858a11cb017 /test/functional/lua/vim_spec.lua | |
parent | 0e8186bdd8699fb20ad70e28813c3603f9ff0ece (diff) | |
download | rneovim-179faa3edd6120a483b55aadf0a367fbf07b25fd.tar.gz rneovim-179faa3edd6120a483b55aadf0a367fbf07b25fd.tar.bz2 rneovim-179faa3edd6120a483b55aadf0a367fbf07b25fd.zip |
fix(lua): clear got_int when calling vim.on_key() callback (#18979)
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r-- | test/functional/lua/vim_spec.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 861f85674f..1af46b7c2f 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -23,6 +23,7 @@ local mkdir_p = helpers.mkdir_p local rmdir = helpers.rmdir local write_file = helpers.write_file local expect_exit = helpers.expect_exit +local poke_eventloop = helpers.poke_eventloop describe('lua stdlib', function() before_each(clear) @@ -2268,6 +2269,22 @@ describe('lua stdlib', function() eq('iworld<ESC>', exec_lua[[return table.concat(keys, '')]]) end) + + it('can call vim.fn functions on Ctrl-C #17273', function() + exec_lua([[ + _G.ctrl_c_cmdtype = '' + + vim.on_key(function(c) + if c == '\3' then + _G.ctrl_c_cmdtype = vim.fn.getcmdtype() + end + end) + ]]) + feed('/') + poke_eventloop() -- This is needed because Ctrl-C flushes input + feed('<C-C>') + eq('/', exec_lua([[return _G.ctrl_c_cmdtype]])) + end) end) describe('vim.wait', function() |