diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-13 11:07:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-13 11:07:57 +0200 |
commit | 2b926fcb3c5d8bd09a219009336bbec7c66ae67e (patch) | |
tree | c722b859ccced5352dd2317cc40790b53b0bfb7c | |
parent | 60d0871000e9abf3716ee035cba5b5a9d659e327 (diff) |
patch 8.1.0279: 'incsearch' highlighting does not skip white spacev8.1.0279
Problem: 'incsearch' highlighting does not skip white space.
Solution: Skip white space after the command. (issue #3321)
-rw-r--r-- | src/ex_getln.c | 3 | ||||
-rw-r--r-- | src/testdir/dumps/Test_incsearch_substitute_05.dump | 9 | ||||
-rw-r--r-- | src/testdir/test_search.vim | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 19 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 22f35e1ecb..8765ac5b24 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -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 index 0000000000..6ec8ea33a2 --- /dev/null +++ b/src/testdir/dumps/Test_incsearch_substitute_05.dump @@ -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 diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index 38e46cc85b..05046b3c0f 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -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 diff --git a/src/version.c b/src/version.c index e1f2c6f2c8..4a9dd14232 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 279, +/**/ 278, /**/ 277, |