Skip to content

Commit 8d4ce56

Browse files
committed
patch 8.1.0851: feedkeys() with "L" does not work properly
Problem: feedkeys() with "L" does not work properly. Solution: Do not set typebuf_was_filled when using "L". (Ozaki Kiichi, closes #3885)
1 parent 98ad1e1 commit 8d4ce56

5 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/evalfunc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3705,15 +3705,18 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
37053705
#endif
37063706
}
37073707
else
3708+
{
37083709
ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
37093710
insert ? 0 : typebuf.tb_len, !typed, FALSE);
3710-
vim_free(keys_esc);
3711-
if (vgetc_busy
3711+
if (vgetc_busy
37123712
#ifdef FEAT_TIMERS
3713-
|| timer_busy
3713+
|| timer_busy
37143714
#endif
3715-
)
3716-
typebuf_was_filled = TRUE;
3715+
)
3716+
typebuf_was_filled = TRUE;
3717+
}
3718+
vim_free(keys_esc);
3719+
37173720
if (execute)
37183721
{
37193722
int save_msg_scroll = msg_scroll;

src/testdir/test_autocmd.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if has('timers')
5050
au CursorHoldI * let g:triggered += 1
5151
set updatetime=500
5252
call job_start(has('win32') ? 'cmd /c echo:' : 'echo',
53-
\ {'exit_cb': {j, s -> timer_start(1000, 'ExitInsertMode')}})
53+
\ {'exit_cb': {-> timer_start(1000, 'ExitInsertMode')}})
5454
call feedkeys('a', 'x!')
5555
call assert_equal(1, g:triggered)
5656
unlet g:triggered

src/testdir/test_mapping.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func Test_map_timeout_with_timer_interrupt()
215215
set timeout timeoutlen=1000
216216

217217
func ExitCb(job, status)
218-
let g:timer = timer_start(1, {_ -> feedkeys("3\<Esc>", 't')})
218+
let g:timer = timer_start(1, {-> feedkeys("3\<Esc>", 't')})
219219
endfunc
220220

221221
call job_start([&shell, &shellcmdflag, 'echo'], {'exit_cb': 'ExitCb'})

src/testdir/test_timers.vim

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,14 @@ func Test_peek_and_get_char()
251251
endfunc
252252

253253
func Test_getchar_zero()
254-
if has('win32')
254+
if has('win32') && !has('gui_running')
255255
" Console: no low-level input
256-
" GUI: somehow doesn't work
257256
return
258257
endif
259258

260259
" Measure the elapsed time to avoid a hang when it fails.
261260
let start = reltime()
262-
let id = timer_start(20, {id -> feedkeys('x', 'L')})
261+
let id = timer_start(20, {-> feedkeys('x', 'L')})
263262
let c = 0
264263
while c == 0 && reltimefloat(reltime(start)) < 0.2
265264
let c = getchar(0)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ static char *(features[]) =
783783

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
851,
786788
/**/
787789
850,
788790
/**/

0 commit comments

Comments
 (0)