char_u *dummy;
exarg_T ea;
pos_T save_cursor;
+ int use_last_pat;
*skiplen = 0;
*patlen = ccline.cmdlen;
delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++;
end = skip_regexp(p, delim, p_magic, NULL);
- if (end == p && *end != delim)
+ use_last_pat = end == p && *end == delim;
+
+ if (end == p && !use_last_pat)
return FALSE;
- // found a non-empty pattern or //
+ // Don't do 'hlsearch' highlighting if the pattern matches everything.
+ if (!use_last_pat)
+ {
+ char c = *end;
+ int empty;
+
+ *end = NUL;
+ empty = empty_pattern(p);
+ *end = c;
+ if (empty)
+ return FALSE;
+ }
+
+ // found a non-empty pattern or //
*skiplen = (int)(p - ccline.cmdbuff);
*patlen = (int)(end - p);
else
end_pos = curwin->w_cursor; // shutup gcc 4
- // Disable 'hlsearch' highlighting if the pattern matches everything.
- // Avoids a flash when typing "foo\|".
- if (!use_last_pat)
- {
- next_char = ccline.cmdbuff[skiplen + patlen];
- ccline.cmdbuff[skiplen + patlen] = NUL;
- if (empty_pattern(ccline.cmdbuff))
- set_no_hlsearch(TRUE);
- ccline.cmdbuff[skiplen + patlen] = next_char;
- }
-
validate_cursor();
// May redraw the status line to show the cursor position.
if (p_ru && curwin->w_status_height > 0)
call VerifyScreenDump(buf, 'Test_incsearch_substitute_08', {})
call term_sendkeys(buf, "\<Esc>")
+ " Only \v handled as empty pattern, does not move cursor
+ call term_sendkeys(buf, '3G4G')
+ call term_sendkeys(buf, ":nohlsearch\<CR>")
+ call term_sendkeys(buf, ':6,7s/\v')
+ sleep 100m
+ call VerifyScreenDump(buf, 'Test_incsearch_substitute_09', {})
+ call term_sendkeys(buf, "\<Esc>")
+
call StopVimInTerminal(buf)
call delete('Xis_subst_script')
endfunc