Prevent prompts during inccommand previews

For example, "Backwards range given, OK to swap (y/n)?" on each keypress.
This commit is contained in:
Rob Pilling 2019-10-29 22:32:25 +00:00
parent d52d782389
commit d04ab11f24
2 changed files with 45 additions and 0 deletions

View File

@ -1927,7 +1927,9 @@ static int command_line_changed(CommandLineState *s)
// - Immediately undo the effects.
State |= CMDPREVIEW;
emsg_silent++; // Block error reporting as the command may be incomplete
msg_silent++; // Block messages, namely ones that prompt
do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_NOWAIT);
msg_silent--; // Unblock messages
emsg_silent--; // Unblock error reporting
// Restore the window "view".

View File

@ -2582,6 +2582,49 @@ describe(":substitute", function()
:%s/some\(thing\)\@!/every/^ |
]])
end)
it("doesn't prompt to swap cmd range", function()
screen = Screen.new(50, 8) -- wide to avoid hit-enter prompt
common_setup(screen, "split", default_text)
feed(':2,1s/tw/MO/g')
-- substitution preview should have been made, without prompting
screen:expect([[
{12:MO}o lines |
{11:[No Name] [+] }|
|2| {12:MO}o lines |
{15:~ }|
{15:~ }|
{15:~ }|
{10:[Preview] }|
:2,1s/tw/MO/g^ |
]])
-- but should be prompted on hitting enter
feed('<CR>')
screen:expect([[
{12:MO}o lines |
{11:[No Name] [+] }|
|2| {12:MO}o lines |
{15:~ }|
{15:~ }|
{15:~ }|
{10:[Preview] }|
{13:Backwards range given, OK to swap (y/n)?}^ |
]])
feed('y')
screen:expect([[
Inc substitution on |
^MOo lines |
|
{15:~ }|
{15:~ }|
{15:~ }|
{15:~ }|
{13:Backwards range given, OK to swap (y/n)?}y |
]])
end)
end)
it(':substitute with inccommand during :terminal activity', function()