From 841ec4316c13179fc15ec6d74237377636f7090f Mon Sep 17 00:00:00 2001 From: Aufar Gilbran Date: Wed, 12 Aug 2020 03:09:45 +0800 Subject: vim-patch:8.1.0280: 'incsearch' highlighting does not work for ":g!/" Problem: 'incsearch' highlighting does not work for ":g!/". Solution: Skip the exclamation mark. (Hirohito Higashi) https://github.com/vim/vim/commit/def7b1dc6104a6ce6d7c3e3a615231178601b124 --- src/nvim/ex_getln.c | 7 +++++++ src/nvim/testdir/test_search.vim | 8 ++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 6a60592f14..9769d5f58b 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -299,6 +299,13 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s, && (STRNCMP(cmd, "substitute", p - cmd) == 0 || STRNCMP(cmd, "global", p - cmd) == 0 || STRNCMP(cmd, "vglobal", p - cmd) == 0)) { + // Check for "global!/". + if (*cmd == 'g' && *p == '!') { + p++; + if (*skipwhite(p) == NUL) { + return false; + } + } p = skipwhite(p); delim = *p++; end = skip_regexp(p, delim, p_magic, NULL); diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 0b403f8d2f..01e6f2d61c 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -408,6 +408,14 @@ func Test_search_cmdline3g() undo call feedkeys(":global/the\/d\", 'tx') call assert_equal(' 3 the theother', getline(2)) + undo + call feedkeys(":g!/the\/d\", 'tx') + call assert_equal(1, line('$')) + call assert_equal(' 2 the~e', getline(1)) + undo + call feedkeys(":global!/the\/d\", 'tx') + call assert_equal(1, line('$')) + call assert_equal(' 2 the~e', getline(1)) call Incsearch_cleanup() endfunc -- cgit