From c9e79e52845d51f48f5ea3753a62ab3fe0e40184 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 9 Feb 2024 19:34:36 +0100 Subject: patch 9.1.0088: TextChanged not triggered for :norm! commands 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: #13967 closes: #13984 Signed-off-by: Christian Brabandt --- src/testdir/test_autocmd.vim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/testdir') diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index be73c18197..6e1223275f 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -2706,6 +2706,24 @@ func Test_TextChangedI_with_setline() bwipe! endfunc +func Test_TextChanged_with_norm() + " For unknown reason this fails on MS-Windows + CheckNotMSWindows + CheckFeature terminal + let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3}) + call assert_equal('running', term_getstatus(buf)) + call term_sendkeys(buf, ":let g:a=0\") + call term_wait(buf, 50) + call term_sendkeys(buf, ":au! TextChanged * :let g:a+=1\") + call term_wait(buf, 50) + call term_sendkeys(buf, ":norm! ia\") + call term_wait(buf, 50) + call term_sendkeys(buf, ":echo g:a\") + call term_wait(buf, 50) + call WaitForAssert({-> assert_match('^1.*$', term_getline(buf, 3))}) + bwipe! +endfunc + func Test_Changed_FirstTime() CheckFeature terminal CheckNotGui -- cgit v1.2.3