Skip to content

Commit def7b1d

Browse files
committed
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)
1 parent 2b926fc commit def7b1d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/ex_getln.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ do_incsearch_highlighting(int firstc, incsearch_state_T *is_state,
298298
|| STRNCMP(cmd, "global", p - cmd) == 0
299299
|| STRNCMP(cmd, "vglobal", p - cmd) == 0))
300300
{
301+
// Check for "global!/".
302+
if (*cmd == 'g' && *p == '!')
303+
{
304+
p++;
305+
if (*skipwhite(p) == NUL)
306+
return FALSE;
307+
}
301308
p = skipwhite(p);
302309
delim = *p++;
303310
end = skip_regexp(p, delim, p_magic, NULL);

src/testdir/test_search.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,14 @@ func Test_search_cmdline3g()
399399
undo
400400
call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
401401
call assert_equal(' 3 the theother', getline(2))
402+
undo
403+
call feedkeys(":g!/the\<c-l>/d\<cr>", 'tx')
404+
call assert_equal(1, line('$'))
405+
call assert_equal(' 2 the~e', getline(1))
406+
undo
407+
call feedkeys(":global!/the\<c-l>/d\<cr>", 'tx')
408+
call assert_equal(1, line('$'))
409+
call assert_equal(' 2 the~e', getline(1))
402410

403411
call Incsearch_cleanup()
404412
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+
280,
797799
/**/
798800
279,
799801
/**/

0 commit comments

Comments
 (0)