]> granicus.if.org Git - vim/commitdiff
patch 8.2.5152: search() gets stuck with "c" and skip evaluates to true v8.2.5152
authorzeertzjq <zeertzjq@outlook.com>
Thu, 23 Jun 2022 11:04:46 +0000 (12:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 23 Jun 2022 11:04:46 +0000 (12:04 +0100)
Problem:    search() gets stuck with "c" and skip evaluates to true.
Solution:   Reset the SEARCH_START option. (closes #10608)

src/evalfunc.c
src/testdir/test_syntax.vim
src/version.c

index b7d7643ae36d51d80c476b0027368d4ba58b89f0..39706cd8f2613b3adb707cc0da0e7d0fc866120f 100644 (file)
@@ -8543,6 +8543,9 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
            if (!do_skip)
                break;
        }
+
+       // clear the start flag to avoid getting stuck here
+       options &= ~SEARCH_START;
     }
 
     if (subpatnum != FAIL)
index 589470b684d6bc285f85179ab1837836961d5772..93e56d7985b74a45542aad7774ea8c99e5375910 100644 (file)
@@ -838,8 +838,9 @@ func Test_search_syntax_skip()
   1
   call search('VIM', 'w', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") =~? "comment"')
   call assert_equal('Another Text for VIM', getline('.'))
+
   1
-  call search('VIM', 'w', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") !~? "string"')
+  call search('VIM', 'cw', '', 0, 'synIDattr(synID(line("."), col("."), 1), "name") !~? "string"')
   call assert_equal(' let a = "VIM"', getline('.'))
 
   " Skip argument using Lambda.
@@ -848,26 +849,27 @@ func Test_search_syntax_skip()
   call assert_equal('Another Text for VIM', getline('.'))
 
   1
-  call search('VIM', 'w', '', 0, { -> synIDattr(synID(line("."), col("."), 1), "name") !~? "string"})
+  call search('VIM', 'cw', '', 0, { -> synIDattr(synID(line("."), col("."), 1), "name") !~? "string"})
   call assert_equal(' let a = "VIM"', getline('.'))
 
   " Skip argument using funcref.
   func InComment()
     return synIDattr(synID(line("."), col("."), 1), "name") =~? "comment"
   endfunc
-  func InString()
+  func NotInString()
     return synIDattr(synID(line("."), col("."), 1), "name") !~? "string"
   endfunc
+
   1
   call search('VIM', 'w', '', 0, function('InComment'))
   call assert_equal('Another Text for VIM', getline('.'))
 
   1
-  call search('VIM', 'w', '', 0, function('InString'))
+  call search('VIM', 'cw', '', 0, function('NotInString'))
   call assert_equal(' let a = "VIM"', getline('.'))
 
   delfunc InComment
-  delfunc InString
+  delfunc NotInString
   bwipe!
 endfunc
 
index bb3f1665fe82ba785d1fc094c0dba887afdc3afa..647daa2d616633addc6051b3cf32bf1391d16d05 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5152,
 /**/
     5151,
 /**/