]> granicus.if.org Git - vim/commitdiff
patch 8.1.0274: 'incsearch' triggers on ":source" v8.1.0274
authorBram Moolenaar <Bram@vim.org>
Sat, 11 Aug 2018 17:20:49 +0000 (19:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 11 Aug 2018 17:20:49 +0000 (19:20 +0200)
Problem:    'incsearch' triggers on ":source".
Solution:   Check for the whole command name.

src/ex_getln.c
src/testdir/test_search.vim
src/version.c

index 3fb9c8623351d6f8a593ff19c4006a6830764bba..804013bb3875986b9493881166d62da71f82e2fd 100644 (file)
@@ -293,7 +293,10 @@ do_incsearch_highlighting(int firstc, incsearch_state_T *is_state,
                // Skip over "substitute" to find the pattern separator.
                for (p = cmd; ASCII_ISALPHA(*p); ++p)
                    ;
-               if (*p != NUL)
+               if (*p != NUL
+                       && (STRNCMP(cmd, "substitute", p - cmd) == 0
+                           || STRNCMP(cmd, "global", p - cmd) == 0
+                           || STRNCMP(cmd, "vglobal", p - cmd) == 0))
                {
                    delim = *p++;
                    end = skip_regexp(p, delim, p_magic, NULL);
index 71de172dc9e1d92dbb7e81d767556d938e84f51c..7e8ddbe6408b60e47c3f3b27bedce2f8542d9bbe 100644 (file)
@@ -342,26 +342,6 @@ func Test_searchc()
   bw!
 endfunc
 
-func Test_search_cmdline3()
-  if !exists('+incsearch')
-    return
-  endif
-  " need to disable char_avail,
-  " so that expansion of commandline works
-  call test_override("char_avail", 1)
-  new
-  call setline(1, ['  1', '  2 the~e', '  3 the theother'])
-  set incsearch
-  1
-  " first match
-  call feedkeys("/the\<c-l>\<cr>", 'tx')
-  call assert_equal('  2 the~e', getline('.'))
-  " clean up
-  set noincsearch
-  call test_override("char_avail", 0)
-  bw!
-endfunc
-
 func Cmdline3_prep()
   " need to disable char_avail,
   " so that expansion of commandline works
@@ -377,6 +357,19 @@ func Cmdline3_cleanup()
   bw!
 endfunc
 
+func Test_search_cmdline3()
+  if !exists('+incsearch')
+    return
+  endif
+  call Cmdline3_prep()
+  1
+  " first match
+  call feedkeys("/the\<c-l>\<cr>", 'tx')
+  call assert_equal('  2 the~e', getline('.'))
+
+  call Cmdline3_cleanup()
+endfunc
+
 func Test_search_cmdline3s()
   if !exists('+incsearch')
     return
@@ -385,6 +378,12 @@ func Test_search_cmdline3s()
   1
   call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx')
   call assert_equal('  2 xxxe', getline('.'))
+  undo
+  call feedkeys(":%subs/the\<c-l>/xxx\<cr>", 'tx')
+  call assert_equal('  2 xxxe', getline('.'))
+  undo
+  call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
+  call assert_equal('  2 xxxe', getline('.'))
 
   call Cmdline3_cleanup()
 endfunc
@@ -397,6 +396,9 @@ func Test_search_cmdline3g()
   1
   call feedkeys(":g/the\<c-l>/d\<cr>", 'tx')
   call assert_equal('  3 the theother', getline(2))
+  undo
+  call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
+  call assert_equal('  3 the theother', getline(2))
 
   call Cmdline3_cleanup()
 endfunc
@@ -410,6 +412,10 @@ func Test_search_cmdline3v()
   call feedkeys(":v/the\<c-l>/d\<cr>", 'tx')
   call assert_equal(1, line('$'))
   call assert_equal('  2 the~e', getline(1))
+  undo
+  call feedkeys(":vglobal/the\<c-l>/d\<cr>", 'tx')
+  call assert_equal(1, line('$'))
+  call assert_equal('  2 the~e', getline(1))
 
   call Cmdline3_cleanup()
 endfunc
@@ -518,7 +524,7 @@ func Test_search_cmdline7()
   " so that expansion of commandline works
   call test_override("char_avail", 1)
   new
-  let @/='b'
+  let @/ = 'b'
   call setline(1, [' bbvimb', ''])
   set incsearch
   " first match
index 510ce45d04d4e0cff9ec08a93b09c8b35fe00b1f..8d02863b79a96a9a9260970d72795ac672412448 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    274,
 /**/
     273,
 /**/