summaryrefslogtreecommitdiffstats
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-01-22 20:14:26 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-22 20:14:26 +0000
commit3d79f0a4309995956bd8889940cca22f7a15881d (patch)
treeac4f9160853ae5d514d5cc737f44e301b88fb24d /src/evalfunc.c
parentd343c60df4b0adc6b1baac4d68a72a735ac21dc4 (diff)
patch 9.0.1233: search() loops forever if "skip" is TRUE for all matchesv9.0.1233
Problem: search() loops forever if "skip" is TRUE for all matches. Solution: Keep the position of the first match.
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 5b25e97cbe..7b34e3925b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -8794,7 +8794,8 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
if (subpatnum == FAIL || !use_skip)
// 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.
{