mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(inccommand): block errors when parsing command line again (#24374)
Revert the change to ex_getln.c from a741c7fd04
This commit is contained in:
@ -261,6 +261,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emsg_off++;
|
||||||
exarg_T ea = {
|
exarg_T ea = {
|
||||||
.line1 = 1,
|
.line1 = 1,
|
||||||
.line2 = 1,
|
.line2 = 1,
|
||||||
@ -368,6 +369,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
|||||||
curwin->w_cursor = save_cursor;
|
curwin->w_cursor = save_cursor;
|
||||||
retval = true;
|
retval = true;
|
||||||
theend:
|
theend:
|
||||||
|
emsg_off--;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2427,9 +2429,12 @@ static bool cmdpreview_may_show(CommandLineState *s)
|
|||||||
int cmdpreview_type = 0;
|
int cmdpreview_type = 0;
|
||||||
char *cmdline = xstrdup(ccline.cmdbuff);
|
char *cmdline = xstrdup(ccline.cmdbuff);
|
||||||
const char *errormsg = NULL;
|
const char *errormsg = NULL;
|
||||||
|
emsg_off++; // Block errors when parsing the command line, and don't update v:errmsg
|
||||||
if (!parse_cmdline(cmdline, &ea, &cmdinfo, &errormsg)) {
|
if (!parse_cmdline(cmdline, &ea, &cmdinfo, &errormsg)) {
|
||||||
|
emsg_off--;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
emsg_off--;
|
||||||
|
|
||||||
// Check if command is previewable, if not, don't attempt to show preview
|
// Check if command is previewable, if not, don't attempt to show preview
|
||||||
if (!(ea.argt & EX_PREVIEW)) {
|
if (!(ea.argt & EX_PREVIEW)) {
|
||||||
|
@ -3086,8 +3086,7 @@ end)
|
|||||||
it('long :%s/ with inccommand does not collapse cmdline', function()
|
it('long :%s/ with inccommand does not collapse cmdline', function()
|
||||||
clear()
|
clear()
|
||||||
local screen = Screen.new(10,5)
|
local screen = Screen.new(10,5)
|
||||||
common_setup(screen)
|
common_setup(screen, 'nosplit')
|
||||||
command('set inccommand=nosplit')
|
|
||||||
feed(':%s/AAAAAAA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
|
feed(':%s/AAAAAAA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
|
||||||
'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A')
|
'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@ -3099,6 +3098,21 @@ it('long :%s/ with inccommand does not collapse cmdline', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("with 'inccommand' typing invalid `={expr}` does not show error", function()
|
||||||
|
clear()
|
||||||
|
local screen = Screen.new(30, 6)
|
||||||
|
common_setup(screen, 'nosplit')
|
||||||
|
feed(':edit `=`')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
:edit `=`^ |
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
it("with 'inccommand' typing :filter doesn't segfault or leak memory #19057", function()
|
it("with 'inccommand' typing :filter doesn't segfault or leak memory #19057", function()
|
||||||
clear()
|
clear()
|
||||||
common_setup(nil, 'nosplit')
|
common_setup(nil, 'nosplit')
|
||||||
|
Reference in New Issue
Block a user