diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-23 12:04:46 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-23 12:04:46 +0100 |
commit | 180246cfd1a5842c538fa8a4a0b520f1d95c90c7 (patch) | |
tree | 5e4a2a2cac5e86b7a51130a4c2f8da433640e44a | |
parent | 8eba2bd291b347e3008aa9e565652d51ad638cfa (diff) |
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to truev8.2.5152
Problem: search() gets stuck with "c" and skip evaluates to true.
Solution: Reset the SEARCH_START option. (closes #10608)
-rw-r--r-- | src/evalfunc.c | 3 | ||||
-rw-r--r-- | src/testdir/test_syntax.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index b7d7643ae3..39706cd8f2 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -8543,6 +8543,9 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) if (!do_skip) break; } + + // clear the start flag to avoid getting stuck here + options &= ~SEARCH_START; } if (subpatnum != FAIL) diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim index 589470b684..93e56d7985 100644 --- a/src/testdir/test_syntax.vim +++ b/src/testdir/test_syntax.vim @@ -838,8 +838,9 @@ func Test_search_syntax_skip() 1 call search('VIM', 'w', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") =~? "comment"') call assert_equal('Another Text for VIM', getline('.')) + 1 - call search('VIM', 'w', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") !~? "string"') + call search('VIM', 'cw', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") !~? "string"') call assert_equal(' let a = "VIM"', getline('.')) " Skip argument using Lambda. @@ -848,26 +849,27 @@ func Test_search_syntax_skip() call assert_equal('Another Text for VIM', getline('.')) 1 - call search('VIM', 'w', '', 0, { -> synIDattr(synID(line("."), col("."), 1), "name") !~? "string"}) + call search('VIM', 'cw', '', 0, { -> synIDattr(synID(line("."), col("."), 1), "name") !~? "string"}) call assert_equal(' let a = "VIM"', getline('.')) " Skip argument using funcref. func InComment() return synIDattr(synID(line("."), col("."), 1), "name") =~? "comment" endfunc - func InString() + func NotInString() return synIDattr(synID(line("."), col("."), 1), "name") !~? "string" endfunc + 1 call search('VIM', 'w', '', 0, function('InComment')) call assert_equal('Another Text for VIM', getline('.')) 1 - call search('VIM', 'w', '', 0, function('InString')) + call search('VIM', 'cw', '', 0, function('NotInString')) call assert_equal(' let a = "VIM"', getline('.')) delfunc InComment - delfunc InString + delfunc NotInString bwipe! endfunc diff --git a/src/version.c b/src/version.c index bb3f1665fe..647daa2d61 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5152, +/**/ 5151, /**/ 5150, |