diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-02-05 06:48:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-05 06:48:56 +0800 |
commit | 4317d366691b057ffba4504c1167128a66e4e5c8 (patch) | |
tree | 3e779417963c83e37c8edc80f87544d7ef504fd1 /test/functional/api/vim_spec.lua | |
parent | e4a58a7ca03457668492f8f41189ea2f23700172 (diff) | |
download | rneovim-4317d366691b057ffba4504c1167128a66e4e5c8.tar.gz rneovim-4317d366691b057ffba4504c1167128a66e4e5c8.tar.bz2 rneovim-4317d366691b057ffba4504c1167128a66e4e5c8.zip |
fix(event-loop): process input before events in getchar() (#32322)
Follow-up to #27358.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index dabe3a2c9a..3aa9ba49d5 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -96,12 +96,19 @@ describe('API', function() assert_alive() end) - it('input is processed first when followed immediately by non-fast events', function() + it('input is processed first if 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 }')) + -- Also test with getchar() + async_meths.nvim_command('let g:getchar = 1 | call getchar() | let g:getchar = 0') + eq(1, api.nvim_get_var('getchar')) + async_meths.nvim_input('x') + async_meths.nvim_exec_lua('_G.res1 = vim.g.getchar', {}) + async_meths.nvim_exec_lua('_G.res2 = vim.g.getchar', {}) + eq({ 0, 0 }, exec_lua('return { _G.res1, _G.res2 }')) end) it('does not set CA_COMMAND_BUSY #7254', function() |