diff --git a/src/globals.h b/src/globals.h index f143c8f905..38e9b8bbf5 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1614,7 +1614,7 @@ EXTERN int autocmd_bufnr INIT(= 0); // fnum for on cmdline EXTERN char_u *autocmd_match INIT(= NULL); // name for on cmdline EXTERN int aucmd_cmdline_changed_count INIT(= 0); -EXTERN int did_cursorhold INIT(= FALSE); // set when CursorHold t'gerd +EXTERN int did_cursorhold INIT(= TRUE); // set when CursorHold t'gerd EXTERN pos_T last_cursormoved // for CursorMoved event # ifdef DO_INIT = {0, 0, 0} diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 9d319960bf..fc23db50f0 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -1747,4 +1747,26 @@ func Test_gui_csi_keytrans() call assert_equal('', keytrans("\x9b\xfc\x04D")) endfunc +" Test that CursorHold is NOT triggered at startup before a keypress +func Test_CursorHold_not_triggered_at_startup() + defer delete('Xcursorhold.log') + defer delete('Xcursorhold_test.vim') + call writefile([ + \ 'set updatetime=300', + \ 'let g:cursorhold_triggered = 0', + \ 'autocmd CursorHold * let g:cursorhold_triggered += 1 | call writefile(["CursorHold triggered"], "Xcursorhold.log", "a")', + \ 'call timer_start(400, {-> execute(''call writefile(["g:cursorhold_triggered=" . g:cursorhold_triggered], "Xcursorhold.log", "a") | qa!'')})', + \ ], 'Xcursorhold_test.vim') + + let vimcmd = v:progpath . ' -g -f -N -u NONE -i NONE -S Xcursorhold_test.vim' + call system(vimcmd) + + let lines = filereadable('Xcursorhold.log') ? readfile('Xcursorhold.log') : [] + + " Assert that CursorHold did NOT trigger at startup + call assert_false(index(lines, 'CursorHold triggered') != -1) + let found = filter(copy(lines), 'v:val =~ "^g:cursorhold_triggered="') + call assert_equal(['g:cursorhold_triggered=0'], found) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index ef919bdd8b..adb5654bcd 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1413, /**/ 1412, /**/