From 0f633ff494b5b39b5ca410e75ea3357c79657bcd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 Jan 2023 07:36:01 +0800 Subject: vim-patch:9.0.1233: search() loops forever if "skip" is TRUE for all matches (#21956) Problem: search() loops forever if "skip" is TRUE for all matches. Solution: Keep the position of the first match. https://github.com/vim/vim/commit/3d79f0a4309995956bd8889940cca22f7a15881d Co-authored-by: Bram Moolenaar --- src/nvim/eval/funcs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/eval') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 4692035dd9..c64aad659f 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -6239,7 +6239,9 @@ static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) // didn't find it or no skip argument break; } - firstpos = pos; + if (firstpos.lnum == 0) { + firstpos = pos; + } // If the skip expression matches, ignore this match. { -- cgit