diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-10-28 10:42:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-28 10:42:18 +0800 |
commit | ac353e87aecf02315d82a3ad22725d2bc8140f0c (patch) | |
tree | c5160c0dfe383fd218c716a16ba2ce7b195e35ae /test/old | |
parent | f97248db757ee300b7808c3dd67858d489b604fd (diff) | |
download | rneovim-ac353e87aecf02315d82a3ad22725d2bc8140f0c.tar.gz rneovim-ac353e87aecf02315d82a3ad22725d2bc8140f0c.tar.bz2 rneovim-ac353e87aecf02315d82a3ad22725d2bc8140f0c.zip |
vim-patch:9.0.2075: TextChangedI may not always trigger (#25808)
Problem: TextChangedI may not always trigger
Solution: trigger it in more cases: for insert/
append/change operations, and when
opening a new line,
fixes: vim/vim#13367
closes: vim/vim#13375
https://github.com/vim/vim/commit/4bca4897a12dfb91b3b27e3083fd5f370bd857d1
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test/old')
-rw-r--r-- | test/old/testdir/test_autocmd.vim | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index 447a716331..a2b46daff3 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -2476,28 +2476,27 @@ func Test_ChangedP() call cursor(3, 1) let g:autocmd = '' call feedkeys("o\<esc>", 'tnix') - " `TextChangedI` triggers only if text is actually changed in Insert mode - call assert_equal('', g:autocmd) + call assert_equal('I', g:autocmd) let g:autocmd = '' call feedkeys("Sf", 'tnix') - call assert_equal('I', g:autocmd) + call assert_equal('II', g:autocmd) let g:autocmd = '' call feedkeys("Sf\<C-N>", 'tnix') - call assert_equal('IP', g:autocmd) + call assert_equal('IIP', g:autocmd) let g:autocmd = '' call feedkeys("Sf\<C-N>\<C-N>", 'tnix') - call assert_equal('IPP', g:autocmd) + call assert_equal('IIPP', g:autocmd) let g:autocmd = '' call feedkeys("Sf\<C-N>\<C-N>\<C-N>", 'tnix') - call assert_equal('IPPP', g:autocmd) + call assert_equal('IIPPP', g:autocmd) let g:autocmd = '' call feedkeys("Sf\<C-N>\<C-N>\<C-N>\<C-N>", 'tnix') - call assert_equal('IPPPP', g:autocmd) + call assert_equal('IIPPPP', g:autocmd) call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$')) " TODO: how should it handle completeopt=noinsert,noselect? @@ -3489,6 +3488,25 @@ func Test_Changed_ChangedI() call feedkeys("ibar\<esc>", 'tnix') call assert_equal('', g:autocmd_n) + " If change is a mix of Normal and Insert modes, TextChangedI should trigger + func s:validate_mixed_textchangedi(keys) + call feedkeys("ifoo\<esc>", 'tnix') + let g:autocmd_i = '' + let g:autocmd_n = '' + call feedkeys(a:keys, 'tnix') + call assert_notequal('', g:autocmd_i) + call assert_equal('', g:autocmd_n) + endfunc + + call s:validate_mixed_textchangedi("o\<esc>") + call s:validate_mixed_textchangedi("O\<esc>") + call s:validate_mixed_textchangedi("ciw\<esc>") + call s:validate_mixed_textchangedi("cc\<esc>") + call s:validate_mixed_textchangedi("C\<esc>") + call s:validate_mixed_textchangedi("s\<esc>") + call s:validate_mixed_textchangedi("S\<esc>") + + " CleanUp call test_override("char_avail", 0) au! TextChanged <buffer> |