mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
inccommand: Suppress error reporting when previewing commands
Closes #5912
This commit is contained in:
@@ -6093,7 +6093,6 @@ void ex_substitute(exarg_T *eap)
|
|||||||
int save_w_p_cul = curwin->w_p_cul;
|
int save_w_p_cul = curwin->w_p_cul;
|
||||||
int save_w_p_cuc = curwin->w_p_cuc;
|
int save_w_p_cuc = curwin->w_p_cuc;
|
||||||
|
|
||||||
emsg_off++; // No error messages during command preview.
|
|
||||||
curbuf->b_p_ul = LONG_MAX; // make sure we can undo all changes
|
curbuf->b_p_ul = LONG_MAX; // make sure we can undo all changes
|
||||||
curwin->w_p_cul = false; // Disable 'cursorline'
|
curwin->w_p_cul = false; // Disable 'cursorline'
|
||||||
curwin->w_p_cuc = false; // Disable 'cursorcolumn'
|
curwin->w_p_cuc = false; // Disable 'cursorcolumn'
|
||||||
@@ -6120,6 +6119,5 @@ void ex_substitute(exarg_T *eap)
|
|||||||
restore_search_patterns();
|
restore_search_patterns();
|
||||||
win_size_restore(&save_view);
|
win_size_restore(&save_view);
|
||||||
ga_clear(&save_view);
|
ga_clear(&save_view);
|
||||||
emsg_off--;
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
}
|
}
|
||||||
|
@@ -1607,7 +1607,9 @@ static int command_line_changed(CommandLineState *s)
|
|||||||
// - Update the screen while the effects are in place.
|
// - Update the screen while the effects are in place.
|
||||||
// - Immediately undo the effects.
|
// - Immediately undo the effects.
|
||||||
State |= CMDPREVIEW;
|
State |= CMDPREVIEW;
|
||||||
|
emsg_silent++; // Block error reporting as the command may be incomplete
|
||||||
do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_NOWAIT);
|
do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_NOWAIT);
|
||||||
|
emsg_silent--; // Unblock error reporting
|
||||||
|
|
||||||
// Restore the window "view".
|
// Restore the window "view".
|
||||||
curwin->w_cursor = s->old_cursor;
|
curwin->w_cursor = s->old_cursor;
|
||||||
|
@@ -1201,6 +1201,40 @@ describe(":substitute, 'inccommand' with a failing expression", function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('in the range does not error #5912', function()
|
||||||
|
for _, case in pairs(cases) do
|
||||||
|
refresh(case)
|
||||||
|
feed(':100s/')
|
||||||
|
|
||||||
|
screen:expect([[
|
||||||
|
Inc substitution on |
|
||||||
|
two lines |
|
||||||
|
|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
:100s/^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
feed('<enter>')
|
||||||
|
screen:expect([[
|
||||||
|
Inc substitution on |
|
||||||
|
two lines |
|
||||||
|
^ |
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{14:E16: Invalid range} |
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("'inccommand' and :cnoremap", function()
|
describe("'inccommand' and :cnoremap", function()
|
||||||
|
Reference in New Issue
Block a user