diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 1f75f3e5bc..ca02bb68de 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -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(); diff --git a/test/functional/ui/incsubstitute_spec.lua b/test/functional/ui/incsubstitute_spec.lua index 21c400c481..88c02c7375 100644 --- a/test/functional/ui/incsubstitute_spec.lua +++ b/test/functional/ui/incsubstitute_spec.lua @@ -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]]) + feed([[osome text 2]]) + 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()