mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
Prevent prompts during inccommand previews
For example, "Backwards range given, OK to swap (y/n)?" on each keypress.
This commit is contained in:
@@ -1927,7 +1927,9 @@ static int command_line_changed(CommandLineState *s)
|
|||||||
// - Immediately undo the effects.
|
// - Immediately undo the effects.
|
||||||
State |= CMDPREVIEW;
|
State |= CMDPREVIEW;
|
||||||
emsg_silent++; // Block error reporting as the command may be incomplete
|
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);
|
do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_NOWAIT);
|
||||||
|
msg_silent--; // Unblock messages
|
||||||
emsg_silent--; // Unblock error reporting
|
emsg_silent--; // Unblock error reporting
|
||||||
|
|
||||||
// Restore the window "view".
|
// Restore the window "view".
|
||||||
|
@@ -2582,6 +2582,49 @@ describe(":substitute", function()
|
|||||||
:%s/some\(thing\)\@!/every/^ |
|
:%s/some\(thing\)\@!/every/^ |
|
||||||
]])
|
]])
|
||||||
end)
|
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)
|
end)
|
||||||
|
|
||||||
it(':substitute with inccommand during :terminal activity', function()
|
it(':substitute with inccommand during :terminal activity', function()
|
||||||
|
Reference in New Issue
Block a user