mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
'inccommand': Add tests.
This commit is contained in:
parent
3f7a2d785d
commit
35231312d7
30592
test/functional/fixtures/bigfile.txt
Normal file
30592
test/functional/fixtures/bigfile.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -761,6 +761,7 @@ describe(":substitute, inccommand=split", function()
|
||||
it('does not show split window for :s/', function()
|
||||
feed("2gg")
|
||||
feed(":s/tw")
|
||||
wait()
|
||||
screen:expect([[
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
@ -935,6 +936,89 @@ describe(":substitute, inccommand=split", function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it("deactivates if 'redrawtime' is exceeded #5602", function()
|
||||
-- Assert that 'inccommand' is ENABLED initially.
|
||||
eq("split", eval("&inccommand"))
|
||||
-- Set 'redrawtime' to minimal value, to ensure timeout is triggered.
|
||||
execute("set redrawtime=1 nowrap")
|
||||
-- Load a big file.
|
||||
execute("silent edit! test/functional/fixtures/bigfile.txt")
|
||||
-- Start :substitute with a slow pattern.
|
||||
feed([[:%s/B.*N/x]])
|
||||
wait()
|
||||
|
||||
-- Assert that 'inccommand' is DISABLED in cmdline mode.
|
||||
eq("", eval("&inccommand"))
|
||||
-- Assert that preview cleared (or never manifested).
|
||||
screen:expect([[
|
||||
0000;<control>;Cc;0;BN;;;;;N;N|
|
||||
0001;<control>;Cc;0;BN;;;;;N;S|
|
||||
0002;<control>;Cc;0;BN;;;;;N;S|
|
||||
0003;<control>;Cc;0;BN;;;;;N;E|
|
||||
0004;<control>;Cc;0;BN;;;;;N;E|
|
||||
0005;<control>;Cc;0;BN;;;;;N;E|
|
||||
0006;<control>;Cc;0;BN;;;;;N;A|
|
||||
0007;<control>;Cc;0;BN;;;;;N;B|
|
||||
0008;<control>;Cc;0;BN;;;;;N;B|
|
||||
0009;<control>;Cc;0;S;;;;;N;CH|
|
||||
000A;<control>;Cc;0;B;;;;;N;LI|
|
||||
000B;<control>;Cc;0;S;;;;;N;LI|
|
||||
000C;<control>;Cc;0;WS;;;;;N;F|
|
||||
000D;<control>;Cc;0;B;;;;;N;CA|
|
||||
:%s/B.*N/x^ |
|
||||
]])
|
||||
|
||||
-- Assert that 'inccommand' is again ENABLED after leaving cmdline mode.
|
||||
feed([[<C-\><C-N>]])
|
||||
eq("split", eval("&inccommand"))
|
||||
end)
|
||||
|
||||
it("clears preview if non-previewable command is edited #5585", function()
|
||||
-- Put a non-previewable command in history.
|
||||
execute("echo 'foo'")
|
||||
-- Start an incomplete :substitute command.
|
||||
feed(":1,2s/t/X")
|
||||
|
||||
screen:expect([[
|
||||
Inc subsXitution on |
|
||||
Xwo lines |
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
|
|
||||
{11:[No Name] [+] }|
|
||||
|1| Inc subs{12:X}itution on |
|
||||
|2| {12:X}wo lines |
|
||||
|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{10:[Preview] }|
|
||||
:1,2s/t/X^ |
|
||||
]])
|
||||
|
||||
-- Select the previous command.
|
||||
feed("<C-P>")
|
||||
-- Assert that preview was cleared.
|
||||
screen:expect([[
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
:echo 'foo'^ |
|
||||
]])
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
describe("inccommand=nosplit", function()
|
||||
@ -1046,6 +1130,41 @@ describe("inccommand=nosplit", function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it("clears preview if non-previewable command is edited", function()
|
||||
-- Put a non-previewable command in history.
|
||||
execute("echo 'foo'")
|
||||
-- Start an incomplete :substitute command.
|
||||
feed(":1,2s/t/X")
|
||||
|
||||
screen:expect([[
|
||||
Inc subsXitution on |
|
||||
Xwo lines |
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
:1,2s/t/X^ |
|
||||
]])
|
||||
|
||||
-- Select the previous command.
|
||||
feed("<C-P>")
|
||||
-- Assert that preview was cleared.
|
||||
screen:expect([[
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
Inc substitution on |
|
||||
two lines |
|
||||
|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
{15:~ }|
|
||||
:echo 'foo'^ |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe(":substitute, 'inccommand' with a failing expression", function()
|
||||
|
Loading…
Reference in New Issue
Block a user