diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index a649eab97c..d35d04cdb3 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -241,15 +241,15 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_csi) keys_esc = keys.data; } ins_typebuf((char_u *)keys_esc, (remap ? REMAP_YES : REMAP_NONE), - insert ? 0 : typebuf.tb_len, !typed, false); + insert ? 0 : typebuf.tb_len, !typed, false); + if (vgetc_busy) { + typebuf_was_filled = true; + } if (escape_csi) { xfree(keys_esc); } - if (vgetc_busy) { - typebuf_was_filled = true; - } if (execute) { int save_msg_scroll = msg_scroll; diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 275b053bc9..e3547aea5b 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -52,7 +52,7 @@ if has('timers') au CursorHoldI * let g:triggered += 1 set updatetime=500 call job_start(has('win32') ? 'cmd /c echo:' : 'echo', - \ {'exit_cb': {j, s -> timer_start(1000, 'ExitInsertMode')}}) + \ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}}) call feedkeys('a', 'x!') call assert_equal(1, g:triggered) unlet g:triggered diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 34e62e80e8..f14f292a92 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -287,7 +287,7 @@ func Test_map_timeout_with_timer_interrupt() set timeout timeoutlen=200 func ExitCb(job, status) - let g:timer = timer_start(1, {_ -> feedkeys("3\", 't')}) + let g:timer = timer_start(1, {-> feedkeys("3\", 't')}) endfunc call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'}) diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 6c336e6fa6..c4d74222a4 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -254,15 +254,14 @@ func Test_peek_and_get_char() endfunc func Test_getchar_zero() - if has('win32') + if has('win32') && !has('gui_running') " Console: no low-level input - " GUI: somehow doesn't work return endif " Measure the elapsed time to avoid a hang when it fails. let start = reltime() - let id = timer_start(20, {id -> feedkeys('x', 'L')}) + let id = timer_start(20, {-> feedkeys('x', 'L')}) let c = 0 while c == 0 && reltimefloat(reltime(start)) < 0.2 let c = getchar(0)