diff src/testdir/test_search.vim @ 31802:ddbc560ecc41 v9.0.1233

patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches Commit: https://github.com/vim/vim/commit/3d79f0a4309995956bd8889940cca22f7a15881d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 22 20:14:26 2023 +0000 patch 9.0.1233: search() loops forever if "skip" is TRUE for all matches Problem: search() loops forever if "skip" is TRUE for all matches. Solution: Keep the position of the first match.
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 Jan 2023 21:15:03 +0100
parents c51111774ea8
children df63fa700fc6
line wrap: on
line diff
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1411,6 +1411,22 @@ func Test_subst_word_under_cursor()
   set noincsearch
 endfunc
 
+func Test_search_skip_all_matches()
+  enew
+  call setline(1, ['no match here',
+        \ 'match this line',
+        \ 'nope',
+        \ 'match in this line',
+        \ 'last line',
+        \ ])
+  call cursor(1, 1)
+  let lnum = search('this', '', 0, 0, 'getline(".") =~ "this line"')
+  " Only check that no match is found.  Previously it searched forever.
+  call assert_equal(0, lnum)
+
+  bwipe!
+endfunc
+
 func Test_search_undefined_behaviour()
   CheckFeature terminal