mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
'inccommand': preserve b:changedtick
This commit is contained in:
@@ -6166,6 +6166,7 @@ void ex_substitute(exarg_T *eap)
|
|||||||
// XXX: Must do this *after* u_undo_and_forget(), why?
|
// XXX: Must do this *after* u_undo_and_forget(), why?
|
||||||
close_windows(incsub_buf, false);
|
close_windows(incsub_buf, false);
|
||||||
}
|
}
|
||||||
|
curbuf->b_changedtick = save_changedtick;
|
||||||
curbuf->b_p_ul = save_b_p_ul;
|
curbuf->b_p_ul = save_b_p_ul;
|
||||||
eap->arg = save_eap;
|
eap->arg = save_eap;
|
||||||
restore_search_patterns();
|
restore_search_patterns();
|
||||||
|
@@ -10,6 +10,7 @@ local feed = helpers.feed
|
|||||||
local insert = helpers.insert
|
local insert = helpers.insert
|
||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local neq = helpers.neq
|
local neq = helpers.neq
|
||||||
|
local ok = helpers.ok
|
||||||
local source = helpers.source
|
local source = helpers.source
|
||||||
|
|
||||||
local default_text = [[
|
local default_text = [[
|
||||||
@@ -54,7 +55,7 @@ describe("'incsubstitute' preserves", function()
|
|||||||
|
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
it(':ls functionality', function()
|
it('listed buffers (:ls)', function()
|
||||||
local screen = Screen.new(30,10)
|
local screen = Screen.new(30,10)
|
||||||
common_setup(screen, "split", "ABC")
|
common_setup(screen, "split", "ABC")
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ describe("'incsubstitute' preserves", function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('substitution with various delimiters', function()
|
it(':substitute with various delimiters', function()
|
||||||
for _, case in pairs{"", "split", "nosplit"} do
|
for _, case in pairs{"", "split", "nosplit"} do
|
||||||
clear()
|
clear()
|
||||||
insert(default_text)
|
insert(default_text)
|
||||||
@@ -93,7 +94,7 @@ describe("'incsubstitute' preserves", function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("'undolevels' setting", function()
|
it("'undolevels'", function()
|
||||||
for _, case in pairs{"", "split", "nosplit"} do
|
for _, case in pairs{"", "split", "nosplit"} do
|
||||||
clear()
|
clear()
|
||||||
execute("set undolevels=139")
|
execute("set undolevels=139")
|
||||||
@@ -106,6 +107,25 @@ describe("'incsubstitute' preserves", function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("b:changedtick", function()
|
||||||
|
for _, case in pairs{"", "split", "nosplit"} do
|
||||||
|
clear()
|
||||||
|
execute("set incsubstitute=" .. case)
|
||||||
|
feed([[isome text 1<C-\><C-N>]])
|
||||||
|
feed([[osome text 2<C-\><C-N>]])
|
||||||
|
local expected_tick = eval("b:changedtick")
|
||||||
|
ok(expected_tick > 0)
|
||||||
|
|
||||||
|
expect([[
|
||||||
|
some text 1
|
||||||
|
some text 2]])
|
||||||
|
feed(":%s/e/XXX/")
|
||||||
|
helpers.wait()
|
||||||
|
|
||||||
|
eq(expected_tick, eval("b:changedtick"))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("'incsubstitute' preserves undo", function()
|
describe("'incsubstitute' preserves undo", function()
|
||||||
|
Reference in New Issue
Block a user