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/testdir/test_gn.vim b/src/testdir/test_gn.vim
index 6d48915..d0fdafc 100644
--- a/src/testdir/test_gn.vim
+++ b/src/testdir/test_gn.vim
@@ -131,4 +131,23 @@
set wrapscan&vim
endfu
+func Test_gn_multi_line()
+ new
+ call setline(1, [
+ \ 'func Tm1()',
+ \ ' echo "one"',
+ \ 'endfunc',
+ \ 'func Tm2()',
+ \ ' echo "two"',
+ \ 'endfunc',
+ \ 'func Tm3()',
+ \ ' echo "three"',
+ \ 'endfunc',
+ \])
+ /\v^func Tm\d\(\)\n.*\zs".*"\ze$
+ normal jgnrx
+ call assert_equal(' echo xxxxx', getline(5))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab