mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
vim-patch:8.2.5152: search() gets stuck with "c" and skip evaluates to true
Problem: search() gets stuck with "c" and skip evaluates to true. Solution: Reset the SEARCH_START option. (closes vim/vim#10608)180246cfd1
(cherry picked from commitc527be5600
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
a05da1c05a
commit
c0224b59da
@@ -7760,6 +7760,9 @@ static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// clear the start flag to avoid getting stuck here
|
||||
options &= ~SEARCH_START;
|
||||
}
|
||||
|
||||
if (subpatnum != FAIL) {
|
||||
|
@@ -745,8 +745,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.
|
||||
@@ -755,26 +756,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
|
||||
|
||||
|
Reference in New Issue
Block a user