]> granicus.if.org Git - vim/commitdiff
patch 8.1.0279: 'incsearch' highlighting does not skip white space v8.1.0279
authorBram Moolenaar <Bram@vim.org>
Mon, 13 Aug 2018 09:07:57 +0000 (11:07 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 13 Aug 2018 09:07:57 +0000 (11:07 +0200)
Problem:    'incsearch' highlighting does not skip white space.
Solution:   Skip white space after the command. (issue #3321)

src/ex_getln.c
src/testdir/dumps/Test_incsearch_substitute_05.dump [new file with mode: 0644]
src/testdir/test_search.vim
src/version.c

index 22f35e1ecb213184ff5f8b434dda8da88db4f4b1..8765ac5b246ff00701b81d8488f3d514effdf31c 100644 (file)
@@ -293,11 +293,12 @@ 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 (*skipwhite(p) != NUL
                        && (STRNCMP(cmd, "substitute", p - cmd) == 0
                            || STRNCMP(cmd, "global", p - cmd) == 0
                            || STRNCMP(cmd, "vglobal", p - cmd) == 0))
                {
+                   p = skipwhite(p);
                    delim = *p++;
                    end = skip_regexp(p, delim, p_magic, NULL);
                    if (end > p || *end == delim)
diff --git a/src/testdir/dumps/Test_incsearch_substitute_05.dump b/src/testdir/dumps/Test_incsearch_substitute_05.dump
new file mode 100644 (file)
index 0000000..6ec8ea3
--- /dev/null
@@ -0,0 +1,9 @@
+|f+0&#ffffff0|o@1| |1| @64
+|f+1&&|o|o+0&&| |2| @64
+|f+0&#ffff4012|o|o+0&#ffffff0| |3| @64
+|f|o@1| |4| @64
+|f|o@1| |5| @64
+|f|o@1| |6| @64
+|f|o@1| |7| @64
+|f|o@1| |8| @64
+|:|2|,|3|s|u|b| @1|/|f|o> @57
index 38e46cc85bdf1dc7c199af4c10645dca50db5b4a..05046b3c0f74faa80576b4a52c1040ea153b7a0e 100644 (file)
@@ -868,8 +868,14 @@ func Test_incsearch_substitute_dump()
   call term_sendkeys(buf, ':5,2s/foo')
   sleep 100m
   call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {})
+  call term_sendkeys(buf, "\<Esc>")
 
+  " White space after the command is skipped
+  call term_sendkeys(buf, ':2,3sub  /fo')
+  sleep 100m
+  call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {})
   call term_sendkeys(buf, "\<Esc>")
+
   call StopVimInTerminal(buf)
   call delete('Xis_subst_script')
 endfunc
index e1f2c6f2c87c1504c3e95c70cc822af1e5efaa66..4a9dd1423264d6ad5e732b0b3a1bfb009eb66d08 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    279,
 /**/
     278,
 /**/