aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/inccommand_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
commit9243becbedbb6a1592208051f8fa2b090dcc5e7d (patch)
tree607c2a862ec3f4399b8766383f6f8e04c4aa43b4 /test/functional/ui/inccommand_spec.lua
parent9e40b6e9e1bc67f2d856adb837ee64dd0e25b717 (diff)
parent3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff)
downloadrneovim-usermarks.tar.gz
rneovim-usermarks.tar.bz2
rneovim-usermarks.zip
Merge remote-tracking branch 'upstream/master' into usermarksusermarks
Diffstat (limited to 'test/functional/ui/inccommand_spec.lua')
-rw-r--r--test/functional/ui/inccommand_spec.lua92
1 files changed, 92 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 9ca4673efe..6fbf9b72c8 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -1190,6 +1190,8 @@ describe(":substitute, inccommand=split", function()
end)
it("deactivates if 'redrawtime' is exceeded #5602", function()
+ -- prevent redraws from 'incsearch'
+ meths.set_option('incsearch', false)
-- Assert that 'inccommand' is ENABLED initially.
eq("split", eval("&inccommand"))
-- Set 'redrawtime' to minimal value, to ensure timeout is triggered.
@@ -2972,6 +2974,59 @@ it(':substitute with inccommand, does not crash if range contains invalid marks'
]])
end)
+it(':substitute with inccommand, no unnecessary redraw if preview is not shown', function()
+ local screen = Screen.new(60, 6)
+ clear()
+ common_setup(screen, 'split', 'test')
+ feed(':ls<CR>')
+ screen:expect([[
+ test |
+ {15:~ }|
+ {11: }|
+ :ls |
+ 1 %a + "[No Name]" line 1 |
+ {13:Press ENTER or type command to continue}^ |
+ ]])
+ feed(':s')
+ -- no unnecessary redraw, so messages are still shown
+ screen:expect([[
+ test |
+ {15:~ }|
+ {11: }|
+ :ls |
+ 1 %a + "[No Name]" line 1 |
+ :s^ |
+ ]])
+ feed('o')
+ screen:expect([[
+ test |
+ {15:~ }|
+ {11: }|
+ :ls |
+ 1 %a + "[No Name]" line 1 |
+ :so^ |
+ ]])
+ feed('<BS>')
+ screen:expect([[
+ test |
+ {15:~ }|
+ {11: }|
+ :ls |
+ 1 %a + "[No Name]" line 1 |
+ :s^ |
+ ]])
+ feed('/test')
+ -- now inccommand is shown, so screen is redrawn
+ screen:expect([[
+ {12:test} |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ :s/test^ |
+ ]])
+end)
+
it(":substitute doesn't crash with inccommand, if undo is empty #12932", function()
local screen = Screen.new(10,5)
clear()
@@ -2992,6 +3047,43 @@ it(":substitute doesn't crash with inccommand, if undo is empty #12932", functio
assert_alive()
end)
+it(':substitute with inccommand works properly if undo is not synced #20029', function()
+ local screen = Screen.new(30, 6)
+ clear()
+ common_setup(screen, 'nosplit', 'foo\nbar\nbaz')
+ meths.set_keymap('x', '<F2>', '<Esc>`<Oaaaaa asdf<Esc>`>obbbbb asdf<Esc>V`<k:s/asdf/', {})
+ feed('gg0<C-V>lljj<F2>')
+ screen:expect([[
+ aaaaa |
+ foo |
+ bar |
+ baz |
+ bbbbb |
+ :'<,'>s/asdf/^ |
+ ]])
+ feed('hjkl')
+ screen:expect([[
+ aaaaa {12:hjkl} |
+ foo |
+ bar |
+ baz |
+ bbbbb {12:hjkl} |
+ :'<,'>s/asdf/hjkl^ |
+ ]])
+ feed('<CR>')
+ expect([[
+ aaaaa hjkl
+ foo
+ bar
+ baz
+ bbbbb hjkl]])
+ feed('u')
+ expect([[
+ foo
+ bar
+ baz]])
+end)
+
it('long :%s/ with inccommand does not collapse cmdline', function()
local screen = Screen.new(10,5)
clear()