vim-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 vim/vim#3321)
2b926fcb3c
This commit is contained in:
Aufar Gilbran
2020-08-11 00:49:12 +08:00
parent 83f3218b28
commit 8ae47ddf63
2 changed files with 9 additions and 2 deletions

View File

@@ -295,10 +295,11 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
if (*cmd == 's' || *cmd == 'g' || *cmd == 'v') {
// 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) {

View File

@@ -643,8 +643,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