aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/textchanged_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-01 05:39:52 +0800
committerGitHub <noreply@github.com>2024-04-01 05:39:52 +0800
commite005b8d2eb0d5967d46cae604e3fac0ccae37555 (patch)
tree24e20506eb14131e6fad6a36b9b31469bb741813 /test/functional/autocmd/textchanged_spec.lua
parent9b9dab622a89a620419f4e0682d235bd30d705db (diff)
downloadrneovim-e005b8d2eb0d5967d46cae604e3fac0ccae37555.tar.gz
rneovim-e005b8d2eb0d5967d46cae604e3fac0ccae37555.tar.bz2
rneovim-e005b8d2eb0d5967d46cae604e3fac0ccae37555.zip
vim-patch:9.1.0230: TextChanged autocommand not triggered under some circumstances (#28135)
Problem: TextChanged autocommand not triggered under some circumstances (Sergey Vlasov) Solution: Trigger TextChanged when TextChangedI has not been triggered fixes: vim/vim#14332 closes: vim/vim#14339 https://github.com/vim/vim/commit/86032702932995db74fed265ba99ae0c823cb75d Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test/functional/autocmd/textchanged_spec.lua')
-rw-r--r--test/functional/autocmd/textchanged_spec.lua26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/functional/autocmd/textchanged_spec.lua b/test/functional/autocmd/textchanged_spec.lua
index d501560dc1..8d8058da70 100644
--- a/test/functional/autocmd/textchanged_spec.lua
+++ b/test/functional/autocmd/textchanged_spec.lua
@@ -155,10 +155,9 @@ it('TextChangedI and TextChanged', function()
feed('yypi<esc>')
eq('', eval('g:autocmd_i'))
- -- TextChanged should only trigger if change was done in Normal mode
command([[let g:autocmd_n = '']])
feed('ibar<esc>')
- eq('', eval('g:autocmd_n'))
+ eq('N8', eval('g:autocmd_n'))
local function validate_mixed_textchangedi(keys)
feed('ifoo<esc>')
@@ -191,3 +190,26 @@ it('TextChanged is triggered after :norm that enters Insert mode', function()
feed(':norm! ia<CR>')
eq(1, eval('g:a'))
end)
+
+-- oldtest: Test_Changed_ChangedI_2()
+it('TextChanged is triggered after mapping that enters & exits Insert mode', function()
+ exec([[
+ let [g:autocmd_i, g:autocmd_n] = ['','']
+
+ func! TextChangedAutocmdI(char)
+ let g:autocmd_{tolower(a:char)} = a:char .. b:changedtick
+ endfunc
+
+ augroup Test_TextChanged
+ au!
+ au TextChanged <buffer> :call TextChangedAutocmdI('N')
+ au TextChangedI <buffer> :call TextChangedAutocmdI('I')
+ augroup END
+
+ nnoremap <CR> o<Esc>
+ ]])
+
+ feed('<CR>')
+ eq('N3', eval('g:autocmd_n'))
+ eq('', eval('g:autocmd_i'))
+end)