'inccommand': preserve b:changedtick

This commit is contained in:
Justin M. Keyes 2016-11-06 16:57:44 +01:00
parent e4e7b2d239
commit e31f9007e4
2 changed files with 24 additions and 3 deletions

View File

@ -6166,6 +6166,7 @@ void ex_substitute(exarg_T *eap)
// XXX: Must do this *after* u_undo_and_forget(), why?
close_windows(incsub_buf, false);
}
curbuf->b_changedtick = save_changedtick;
curbuf->b_p_ul = save_b_p_ul;
eap->arg = save_eap;
restore_search_patterns();

View File

@ -10,6 +10,7 @@ local feed = helpers.feed
local insert = helpers.insert
local meths = helpers.meths
local neq = helpers.neq
local ok = helpers.ok
local source = helpers.source
local default_text = [[
@ -54,7 +55,7 @@ describe("'incsubstitute' preserves", function()
before_each(clear)
it(':ls functionality', function()
it('listed buffers (:ls)', function()
local screen = Screen.new(30,10)
common_setup(screen, "split", "ABC")
@ -75,7 +76,7 @@ describe("'incsubstitute' preserves", function()
]])
end)
it('substitution with various delimiters', function()
it(':substitute with various delimiters', function()
for _, case in pairs{"", "split", "nosplit"} do
clear()
insert(default_text)
@ -93,7 +94,7 @@ describe("'incsubstitute' preserves", function()
end
end)
it("'undolevels' setting", function()
it("'undolevels'", function()
for _, case in pairs{"", "split", "nosplit"} do
clear()
execute("set undolevels=139")
@ -106,6 +107,25 @@ describe("'incsubstitute' preserves", function()
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)
describe("'incsubstitute' preserves undo", function()