patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Problem: "gn" selects the wrong text with a multi-line match.
Solution: Get the end position from searchit() directly. (closes #3695)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index bd2acef..99e68f7 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -10056,7 +10056,7 @@
}
pos = save_cursor = curwin->w_cursor;
- subpatnum = searchit(curwin, curbuf, &pos, dir, pat, 1L,
+ subpatnum = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
options, RE_SEARCH, (linenr_T)lnum_stop, &tm, NULL);
if (subpatnum != FAIL)
{
@@ -10414,7 +10414,7 @@
pat = pat3;
for (;;)
{
- n = searchit(curwin, curbuf, &pos, dir, pat, 1L,
+ n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
options, RE_SEARCH, lnum_stop, &tm, NULL);
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
/* didn't find it or found the first match again: FAIL */