Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 13240:5ed6e4a25925 v8.0.1494
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
commit https://github.com/vim/vim/commit/5a093437199001a0d60d8e18e2b9539b99a7757c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 10 18:15:19 2018 +0100
patch 8.0.1494: no autocmd triggered in Insert mode with visible popup menu
Problem: No autocmd triggered in Insert mode with visible popup menu.
Solution: Add TextChangedP. (Prabir Shrestha, Christian Brabandt,
closes #2372, closes #1691)
Fix that the TextChanged autocommands are not always triggered
when sourcing a script.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Feb 2018 18:30:06 +0100 |
parents | f83d3a633ccb |
children | 4a44c90dd671 |
comparison
equal
deleted
inserted
replaced
13239:cb07abe792ae | 13240:5ed6e4a25925 |
---|---|
1247 call assert_equal(["auto:", s:dir_other], s:li) | 1247 call assert_equal(["auto:", s:dir_other], s:li) |
1248 set noacd | 1248 set noacd |
1249 bwipe! | 1249 bwipe! |
1250 call s:After_test_dirchanged() | 1250 call s:After_test_dirchanged() |
1251 endfunc | 1251 endfunc |
1252 | |
1253 " Test TextChangedI and TextChangedP | |
1254 func Test_ChangedP() | |
1255 new | |
1256 call setline(1, ['foo', 'bar', 'foobar']) | |
1257 call test_override("char_avail", 1) | |
1258 set complete=. completeopt=menuone | |
1259 | |
1260 func! TextChangedAutocmd(char) | |
1261 let g:autocmd .= a:char | |
1262 endfunc | |
1263 | |
1264 au! TextChanged <buffer> :call TextChangedAutocmd('N') | |
1265 au! TextChangedI <buffer> :call TextChangedAutocmd('I') | |
1266 au! TextChangedP <buffer> :call TextChangedAutocmd('P') | |
1267 | |
1268 call cursor(3, 1) | |
1269 let g:autocmd = '' | |
1270 call feedkeys("o\<esc>", 'tnix') | |
1271 call assert_equal('I', g:autocmd) | |
1272 | |
1273 let g:autocmd = '' | |
1274 call feedkeys("Sf", 'tnix') | |
1275 call assert_equal('II', g:autocmd) | |
1276 | |
1277 let g:autocmd = '' | |
1278 call feedkeys("Sf\<C-N>", 'tnix') | |
1279 call assert_equal('IIP', g:autocmd) | |
1280 | |
1281 let g:autocmd = '' | |
1282 call feedkeys("Sf\<C-N>\<C-N>", 'tnix') | |
1283 call assert_equal('IIPP', g:autocmd) | |
1284 | |
1285 let g:autocmd = '' | |
1286 call feedkeys("Sf\<C-N>\<C-N>\<C-N>", 'tnix') | |
1287 call assert_equal('IIPPP', g:autocmd) | |
1288 | |
1289 let g:autocmd = '' | |
1290 call feedkeys("Sf\<C-N>\<C-N>\<C-N>\<C-N>", 'tnix') | |
1291 call assert_equal('IIPPPP', g:autocmd) | |
1292 | |
1293 call assert_equal(['foo', 'bar', 'foobar', 'foo'], getline(1, '$')) | |
1294 " TODO: how should it handle completeopt=noinsert,noselect? | |
1295 | |
1296 " CleanUp | |
1297 call test_override("char_avail", 0) | |
1298 au! TextChanged | |
1299 au! TextChangedI | |
1300 au! TextChangedP | |
1301 delfu TextChangedAutocmd | |
1302 unlet! g:autocmd | |
1303 set complete&vim completeopt&vim | |
1304 | |
1305 bw! | |
1306 endfunc |