vim-patch:8.2.3517: TextChanged does not trigger after TextChangedI (#25384)

Problem:    TextChanged does not trigger after TextChangedI.
Solution:   Store the tick separately for TextChangedI. (Christian Brabandt,
            closes vim/vim#8968, closes vim/vim#8932)

db3b44640d

Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2023-09-27 18:51:40 +08:00
committed by GitHub
parent dfa8b582a6
commit b65f4151d9
7 changed files with 204 additions and 100 deletions

View File

@@ -1032,93 +1032,6 @@ describe('completion', function()
]])
end)
-- oldtest: Test_ChangedP()
it('TextChangedI and TextChangedP autocommands', function()
curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar'})
source([[
set complete=. completeopt=menuone
let g:foo = []
autocmd! TextChanged * :call add(g:foo, "N")
autocmd! TextChangedI * :call add(g:foo, "I")
autocmd! TextChangedP * :call add(g:foo, "P")
call cursor(3, 1)
]])
command('let g:foo = []')
feed('o')
poke_eventloop()
feed('<esc>')
eq({'I'}, eval('g:foo'))
command('let g:foo = []')
feed('S')
poke_eventloop()
feed('f')
poke_eventloop()
eq({'I', 'I'}, eval('g:foo'))
feed('<esc>')
command('let g:foo = []')
feed('S')
poke_eventloop()
feed('f')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
eq({'I', 'I', 'P'}, eval('g:foo'))
feed('<esc>')
command('let g:foo = []')
feed('S')
poke_eventloop()
feed('f')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
eq({'I', 'I', 'P', 'P'}, eval('g:foo'))
feed('<esc>')
command('let g:foo = []')
feed('S')
poke_eventloop()
feed('f')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
eq({'I', 'I', 'P', 'P', 'P'}, eval('g:foo'))
feed('<esc>')
command('let g:foo = []')
feed('S')
poke_eventloop()
feed('f')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
feed('<C-N>')
poke_eventloop()
feed('<C-N>')
eq({'I', 'I', 'P', 'P', 'P', 'P'}, eval('g:foo'))
feed('<esc>')
eq({'foo', 'bar', 'foobar', 'foo'}, eval('getline(1, "$")'))
source([[
au! TextChanged
au! TextChangedI
au! TextChangedP
set complete&vim completeopt&vim
]])
end)
it('CompleteChanged autocommand', function()
curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar', ''})
source([[