diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-21 12:19:53 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-21 12:19:53 +0200 |
commit | b53e13a91ab2fc9d52bd044715daa84972f4ce47 (patch) | |
tree | 6df807962d3719c50e6c33beaeaf8bc23ab8b12e /src/testdir/test_edit.vim | |
parent | 20d89e0ac65686481f97657008deede0b39ef5db (diff) |
patch 8.2.1874: can't do something just before leaving Insert modev8.2.1874
Problem: Can't do something just before leaving Insert mode.
Solution: Add the InsertLeavePre autocommand event. (closes #7177)
Diffstat (limited to 'src/testdir/test_edit.vim')
-rw-r--r-- | src/testdir/test_edit.vim | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index ac893f39bc..6a84b1c8c6 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1446,31 +1446,40 @@ endfunc func Test_edit_InsertLeave() new + au InsertLeavePre * let g:did_au_pre = 1 au InsertLeave * let g:did_au = 1 + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("afoo\<Esc>", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(1, g:did_au) call assert_equal('foo', getline(1)) + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("Sbar\<C-C>", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(0, g:did_au) call assert_equal('bar', getline(1)) inoremap x xx<Esc> + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("Saax", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(1, g:did_au) call assert_equal('aaxx', getline(1)) inoremap x xx<C-C> + let g:did_au_pre = 0 let g:did_au = 0 call feedkeys("Sbbx", 'tx') + call assert_equal(1, g:did_au_pre) call assert_equal(0, g:did_au) call assert_equal('bbxx', getline(1)) bwipe! - au! InsertLeave + au! InsertLeave InsertLeavePre iunmap x endfunc |