diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-07 12:11:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-07 12:11:22 +0800 |
commit | 6725565258930ba430cfb925fd1671596a8a4342 (patch) | |
tree | 9671a7cab469f5ea309be6ce3c4ab3f39f55e97a /test/functional/api/vim_spec.lua | |
parent | c0b99bb1de8de967d82fc29780996ed4060516c1 (diff) | |
download | rneovim-6725565258930ba430cfb925fd1671596a8a4342.tar.gz rneovim-6725565258930ba430cfb925fd1671596a8a4342.tar.bz2 rneovim-6725565258930ba430cfb925fd1671596a8a4342.zip |
fix(event-loop): process input before events (#27358)
Problem:
When nvim_input is followed immediately by non-fast events on RPC, both
events and input are available after the polling done by the os_inchar()
in state_enter(), but state_enter() then chooses to process events even
if input is available, which is inconsistent with state_handle_k_event()
that stops processing events once input is available.
Solution:
Also check for available input after the os_inchar() in state_enter().
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 5cf48412a8..4cd46f5e91 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -95,6 +95,14 @@ describe('API', function() assert_alive() end) + it('input is processed first when followed immediately by non-fast events', function() + api.nvim_set_current_line('ab') + async_meths.nvim_input('x') + async_meths.nvim_exec_lua('_G.res1 = vim.api.nvim_get_current_line()', {}) + async_meths.nvim_exec_lua('_G.res2 = vim.api.nvim_get_current_line()', {}) + eq({ 'b', 'b' }, exec_lua('return { _G.res1, _G.res2 }')) + end) + it('does not set CA_COMMAND_BUSY #7254', function() command('split') command('autocmd WinEnter * startinsert') |