aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-26 07:00:37 +0800
committerGitHub <noreply@github.com>2022-09-26 07:00:37 +0800
commita6c9764edaa349f5f268e5e3bf8b940e137fb5c4 (patch)
tree22feafa1fce1e24f281a70733cc8599efb50f03e /test
parentf8a1cadccff39923643fdea2e282be9fffa60e99 (diff)
downloadrneovim-a6c9764edaa349f5f268e5e3bf8b940e137fb5c4.tar.gz
rneovim-a6c9764edaa349f5f268e5e3bf8b940e137fb5c4.tar.bz2
rneovim-a6c9764edaa349f5f268e5e3bf8b940e137fb5c4.zip
fix(inccommand): deal with unsynced undo (#20041)
Diffstat (limited to 'test')
-rw-r--r--test/functional/ui/inccommand_spec.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 49b3c7a655..6fbf9b72c8 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -3047,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()