mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.2338: using Visual mark sith :s gives E20 if not set
Problem: Using Visual mark sith :s gives E20 if not set. Solution: Ignore errors when handling 'incsearch'. (closes vim/vim#3837)c672525b48
N/A patches for version.c: vim-patch:8.2.1526: line in testdir Makefile got commented out Problem: Line in testdir Makefile got commented out. (Christian Brabandt) Solution: Revert.228e62975e
vim-patch:8.2.1675: MinGW: testdir makefile deletes non-existing file Problem: MinGW: testdir makefile deletes non-existing file. Solution: Use another way to delete the output file if it already exists. (Michael Soyka)05c1acd5e1
This commit is contained in:
parent
f34eeba2d8
commit
ea03032018
@ -288,6 +288,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
exarg_T ea;
|
exarg_T ea;
|
||||||
pos_T save_cursor;
|
pos_T save_cursor;
|
||||||
bool use_last_pat;
|
bool use_last_pat;
|
||||||
|
bool retval = false;
|
||||||
|
|
||||||
*skiplen = 0;
|
*skiplen = 0;
|
||||||
*patlen = ccline.cmdlen;
|
*patlen = ccline.cmdlen;
|
||||||
@ -307,6 +308,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emsg_off++;
|
||||||
memset(&ea, 0, sizeof(ea));
|
memset(&ea, 0, sizeof(ea));
|
||||||
ea.line1 = 1;
|
ea.line1 = 1;
|
||||||
ea.line2 = 1;
|
ea.line2 = 1;
|
||||||
@ -318,13 +320,13 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
|
|
||||||
cmd = skip_range(ea.cmd, NULL);
|
cmd = skip_range(ea.cmd, NULL);
|
||||||
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL) {
|
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL) {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip over "substitute" to find the pattern separator.
|
// Skip over "substitute" to find the pattern separator.
|
||||||
for (p = cmd; ASCII_ISALPHA(*p); p++) {}
|
for (p = cmd; ASCII_ISALPHA(*p); p++) {}
|
||||||
if (*skipwhite(p) == NUL) {
|
if (*skipwhite(p) == NUL) {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STRNCMP(cmd, "substitute", p - cmd) == 0
|
if (STRNCMP(cmd, "substitute", p - cmd) == 0
|
||||||
@ -342,7 +344,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
} else if (STRNCMP(cmd, "vimgrep", MAX(p - cmd, 3)) == 0
|
} else if (STRNCMP(cmd, "vimgrep", MAX(p - cmd, 3)) == 0
|
||||||
|| STRNCMP(cmd, "vimgrepadd", MAX(p - cmd, 8)) == 0
|
|| STRNCMP(cmd, "vimgrepadd", MAX(p - cmd, 8)) == 0
|
||||||
@ -353,14 +355,14 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
if (*p == '!') {
|
if (*p == '!') {
|
||||||
p++;
|
p++;
|
||||||
if (*skipwhite(p) == NUL) {
|
if (*skipwhite(p) == NUL) {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*cmd != 'g') {
|
if (*cmd != 'g') {
|
||||||
delim_optional = true;
|
delim_optional = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
@ -369,7 +371,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
|
|
||||||
use_last_pat = end == p && *end == delim;
|
use_last_pat = end == p && *end == delim;
|
||||||
if (end == p && !use_last_pat) {
|
if (end == p && !use_last_pat) {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do 'hlsearch' highlighting if the pattern matches everything.
|
// Don't do 'hlsearch' highlighting if the pattern matches everything.
|
||||||
@ -381,7 +383,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
empty = empty_pattern(p);
|
empty = empty_pattern(p);
|
||||||
*end = c;
|
*end = c;
|
||||||
if (empty) {
|
if (empty) {
|
||||||
return false;
|
goto theend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +411,10 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
curwin->w_cursor = save_cursor;
|
curwin->w_cursor = save_cursor;
|
||||||
return true;
|
retval = true;
|
||||||
|
theend:
|
||||||
|
emsg_off--;
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
// May do 'incsearch' highlighting if desired.
|
// May do 'incsearch' highlighting if desired.
|
||||||
|
@ -708,6 +708,19 @@ func Test_incsearch_substitute_dump()
|
|||||||
call VerifyScreenDump(buf, 'Test_incsearch_substitute_12', {})
|
call VerifyScreenDump(buf, 'Test_incsearch_substitute_12', {})
|
||||||
call term_sendkeys(buf, "\<Esc>")
|
call term_sendkeys(buf, "\<Esc>")
|
||||||
call VerifyScreenDump(buf, 'Test_incsearch_substitute_13', {})
|
call VerifyScreenDump(buf, 'Test_incsearch_substitute_13', {})
|
||||||
|
call term_sendkeys(buf, ":%bwipe!\<CR>")
|
||||||
|
call term_sendkeys(buf, ":only!\<CR>")
|
||||||
|
|
||||||
|
" get :'<,'>s command in history
|
||||||
|
call term_sendkeys(buf, ":set cmdheight=2\<CR>")
|
||||||
|
call term_sendkeys(buf, "aasdfasdf\<Esc>")
|
||||||
|
call term_sendkeys(buf, "V:s/a/b/g\<CR>")
|
||||||
|
" Using '<,'> does not give E20
|
||||||
|
call term_sendkeys(buf, ":new\<CR>")
|
||||||
|
call term_sendkeys(buf, "aasdfasdf\<Esc>")
|
||||||
|
call term_sendkeys(buf, ":\<Up>\<Up>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_incsearch_substitute_14', {})
|
||||||
|
call term_sendkeys(buf, "<Esc>")
|
||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('Xis_subst_script')
|
call delete('Xis_subst_script')
|
||||||
|
Loading…
Reference in New Issue
Block a user