aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/state.c2
-rw-r--r--test/functional/api/vim_spec.lua8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/state.c b/src/nvim/state.c
index 527acee306..0df060ecf4 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -79,7 +79,7 @@ getkey:
// mapping engine.
os_inchar(NULL, 0, -1, typebuf.tb_change_cnt, main_loop.events);
// If an event was put into the queue, we send K_EVENT directly.
- if (!multiqueue_empty(main_loop.events)) {
+ if (!input_available() && !multiqueue_empty(main_loop.events)) {
key = K_EVENT;
} else {
goto getkey;
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')