# HG changeset patch # User Bram Moolenaar # Date 1676112304 -3600 # Node ID 929a9427862cb4b0d2501aec74158f99bc4cfa2e # Parent 82d3cd3c6b40ae016f915e2f727c2002dad49ecf patch 9.0.1299: change for triggering incsearch not sufficiently tested Commit: https://github.com/vim/vim/commit/412e0e4ed903682f352d8ea58ded480930cc664f Author: zeertzjq Date: Sat Feb 11 10:34:07 2023 +0000 patch 9.0.1299: change for triggering incsearch not sufficiently tested Problem: Change for triggering incsearch not sufficiently tested. Solution: Add a test case. Simplify the code. (closes https://github.com/vim/vim/issues/11971) diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1253,9 +1253,9 @@ cmdline_insert_reg(int *gotesc UNUSED) // remove the double quote redrawcmd(); - // The text has been stuffed, the command line didn't change yet, but it - // will change soon. The caller must take care of it. - return literally ? CMDLINE_NOT_CHANGED : CMDLINE_CHANGED; + // With "literally": the command line has already changed. + // Else: the text has been stuffed, but the command line didn't change yet. + return literally ? CMDLINE_CHANGED : CMDLINE_NOT_CHANGED; } /* @@ -2086,10 +2086,8 @@ getcmdline_int( res = cmdline_insert_reg(&gotesc); if (res == GOTO_NORMAL_MODE) goto returncmd; -#ifdef FEAT_SEARCH_EXTRA - if (res == CMDLINE_NOT_CHANGED) - is_state.incsearch_postponed = TRUE; -#endif + if (res == CMDLINE_CHANGED) + goto cmdline_changed; goto cmdline_not_changed; case Ctrl_D: diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -1909,17 +1909,15 @@ func Test_Cmdline() call assert_equal(':', g:entered) au! CmdlineChanged + autocmd CmdlineChanged : let g:log += [getcmdline()] + let g:log = [] cnoremap call setcmdline('ls') - autocmd CmdlineChanged : let g:log += [getcmdline()] call feedkeys(":\", 'xt') call assert_equal(['ls'], g:log) - unlet g:log - au! CmdlineChanged cunmap let g:log = [] - autocmd CmdlineChanged : let g:log += [getcmdline()] call feedkeys(":sign \\\\\\\", 'xt') call assert_equal([ \ 's', @@ -1950,6 +1948,22 @@ func Test_Cmdline() \ 'sign unplace', \ ], g:log) set wildmenu& wildoptions& + + let g:log = [] + let @r = 'abc' + call feedkeys(":0\r1\\r2\\r3\", 'xt') + call assert_equal([ + \ '0', + \ '0a', + \ '0ab', + \ '0abc', + \ '0abc1', + \ '0abc1abc', + \ '0abc1abc2', + \ '0abc1abc2abc', + \ '0abc1abc2abc3', + \ ], g:log) + unlet g:log au! CmdlineChanged diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1299, +/**/ 1298, /**/ 1297,