From 3f419d84fbb918836fd90f2e09eace7ce3266f6b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 10 Feb 2024 06:53:26 +0800 Subject: vim-patch:9.1.0088: TextChanged not triggered for :norm! commands (#27405) Problem: TextChanged not triggered for :norm! commands (machakann, after v9.0.2031) Solution: Only reset curbuf->b_last_changedtick if TextChangedI was triggered in insert mode (and not blocked) Note: for unknown reasons, the test fails on Windows (but seems to work fine when running interactively) fixes: vim/vim#13967 closes: vim/vim#13984 https://github.com/vim/vim/commit/c9e79e52845d51f48f5ea3753a62ab3fe0e40184 Cherry-pick test_autocmd.vim change from patch 8.2.4149. Co-authored-by: Christian Brabandt --- test/functional/autocmd/textchanged_spec.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/functional') diff --git a/test/functional/autocmd/textchanged_spec.lua b/test/functional/autocmd/textchanged_spec.lua index 850d67a18d..d501560dc1 100644 --- a/test/functional/autocmd/textchanged_spec.lua +++ b/test/functional/autocmd/textchanged_spec.lua @@ -180,3 +180,14 @@ it('TextChangedI and TextChanged', function() validate_mixed_textchangedi({ 's', '' }) validate_mixed_textchangedi({ 'S', '' }) end) + +-- oldtest: Test_TextChanged_with_norm() +it('TextChanged is triggered after :norm that enters Insert mode', function() + exec([[ + let g:a = 0 + au TextChanged * let g:a += 1 + ]]) + eq(0, eval('g:a')) + feed(':norm! ia') + eq(1, eval('g:a')) +end) -- cgit