aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/inccommand_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-12-07 12:04:02 +0800
committerGitHub <noreply@github.com>2023-12-07 12:04:02 +0800
commit1dba570e63edcc69d6661bdcb9857def8bb18039 (patch)
treee259baf3c0e73c05e4820d0ae0aeadc3da4e670b /test/functional/ui/inccommand_spec.lua
parenta4047e0b8063ddc8da11bb89d3aba9cf614dbaa8 (diff)
downloadrneovim-1dba570e63edcc69d6661bdcb9857def8bb18039.tar.gz
rneovim-1dba570e63edcc69d6661bdcb9857def8bb18039.tar.bz2
rneovim-1dba570e63edcc69d6661bdcb9857def8bb18039.zip
fix(inccommand): save and restore '[ and '] marks (#26442)
Undoing a change moves '[ and '] marks, so it is necessary to save and restore them.
Diffstat (limited to 'test/functional/ui/inccommand_spec.lua')
-rw-r--r--test/functional/ui/inccommand_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 3ee67a710c..ae6d0e6487 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -8,6 +8,7 @@ local feed_command = helpers.feed_command
local expect = helpers.expect
local feed = helpers.feed
local insert = helpers.insert
+local funcs = helpers.funcs
local meths = helpers.meths
local neq = helpers.neq
local ok = helpers.ok
@@ -153,6 +154,29 @@ describe(":substitute, 'inccommand' preserves", function()
]])
end)
+ it("'[ and '] marks #26439", function()
+ local screen = Screen.new(30, 10)
+ common_setup(screen, 'nosplit', ('abc\ndef\n'):rep(50))
+
+ feed('ggyG')
+ local X = meths.get_vvar('maxcol')
+ eq({0, 1, 1, 0}, funcs.getpos("'["))
+ eq({0, 101, X, 0}, funcs.getpos("']"))
+
+ feed(":'[,']s/def/")
+ poke_eventloop()
+ eq({0, 1, 1, 0}, funcs.getpos("'["))
+ eq({0, 101, X, 0}, funcs.getpos("']"))
+
+ feed('DEF/g')
+ poke_eventloop()
+ eq({0, 1, 1, 0}, funcs.getpos("'["))
+ eq({0, 101, X, 0}, funcs.getpos("']"))
+
+ feed('<CR>')
+ expect(('abc\nDEF\n'):rep(50))
+ end)
+
for _, case in pairs{"", "split", "nosplit"} do
it("various delimiters (inccommand="..case..")", function()
insert(default_text)