aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAufar Gilbran <aufargilbran@gmail.com>2020-08-11 00:49:12 +0800
committerAufar Gilbran <aufargilbran@gmail.com>2020-09-11 10:31:41 +0800
commit8ae47ddf63bdc6e880eac2f5752da137507a34c0 (patch)
tree03fe61206b68c67c98ec1fe934328e78568862bd /src
parent83f3218b286eb76e42c21dcd2ec7bec18683ead3 (diff)
downloadrneovim-8ae47ddf63bdc6e880eac2f5752da137507a34c0.tar.gz
rneovim-8ae47ddf63bdc6e880eac2f5752da137507a34c0.tar.bz2
rneovim-8ae47ddf63bdc6e880eac2f5752da137507a34c0.zip
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) https://github.com/vim/vim/commit/2b926fcb3c5d8bd09a219009336bbec7c66ae67e
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c3
-rw-r--r--src/nvim/testdir/test_search.vim6
2 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index a1a889d652..6a60592f14 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -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) {
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index c2584f99b9..0b403f8d2f 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -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