Skip to content

Commit 2b926fc

Browse files
committed
patch 8.1.0279: 'incsearch' highlighting does not skip white space
Problem: 'incsearch' highlighting does not skip white space. Solution: Skip white space after the command. (issue #3321)
1 parent 60d0871 commit 2b926fc

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/ex_getln.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,12 @@ do_incsearch_highlighting(int firstc, incsearch_state_T *is_state,
293293
// Skip over "substitute" to find the pattern separator.
294294
for (p = cmd; ASCII_ISALPHA(*p); ++p)
295295
;
296-
if (*p != NUL
296+
if (*skipwhite(p) != NUL
297297
&& (STRNCMP(cmd, "substitute", p - cmd) == 0
298298
|| STRNCMP(cmd, "global", p - cmd) == 0
299299
|| STRNCMP(cmd, "vglobal", p - cmd) == 0))
300300
{
301+
p = skipwhite(p);
301302
delim = *p++;
302303
end = skip_regexp(p, delim, p_magic, NULL);
303304
if (end > p || *end == delim)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
|f+0&#ffffff0|o@1| |1| @64
2+
|f+1&&|o|o+0&&| |2| @64
3+
|f+0&#ffff4012|o|o+0&#ffffff0| |3| @64
4+
|f|o@1| |4| @64
5+
|f|o@1| |5| @64
6+
|f|o@1| |6| @64
7+
|f|o@1| |7| @64
8+
|f|o@1| |8| @64
9+
|:|2|,|3|s|u|b| @1|/|f|o> @57

src/testdir/test_search.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,14 @@ func Test_incsearch_substitute_dump()
868868
call term_sendkeys(buf, ':5,2s/foo')
869869
sleep 100m
870870
call VerifyScreenDump(buf, 'Test_incsearch_substitute_04', {})
871+
call term_sendkeys(buf, "\<Esc>")
871872

873+
" White space after the command is skipped
874+
call term_sendkeys(buf, ':2,3sub /fo')
875+
sleep 100m
876+
call VerifyScreenDump(buf, 'Test_incsearch_substitute_05', {})
872877
call term_sendkeys(buf, "\<Esc>")
878+
873879
call StopVimInTerminal(buf)
874880
call delete('Xis_subst_script')
875881
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,8 @@ static char *(features[]) =
794794

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
279,
797799
/**/
798800
278,
799801
/**/

0 commit comments

Comments
 (0)