Mercurial > vim
comparison src/testdir/test_popup.vim @ 9465:203792348947 v7.4.2013
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 9 21:49:03 2016 +0200
patch 7.4.2013
Problem: Using "noinsert" in 'completeopt' breaks redo.
Solution: Set compl_curr_match. (Shougo, closes https://github.com/vim/vim/issues/874)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 09 Jul 2016 22:00:06 +0200 |
parents | 35b173e37dc6 |
children | 5fb484647e12 |
comparison
equal
deleted
inserted
replaced
9464:be72f4201a1d | 9465:203792348947 |
---|---|
1 " Test for completion menu | 1 " Test for completion menu |
2 | 2 |
3 inoremap <F5> <C-R>=ListMonths()<CR> | |
4 let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] | 3 let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] |
5 let g:setting = '' | 4 let g:setting = '' |
6 | 5 |
7 func ListMonths() | 6 func ListMonths() |
8 if g:setting != '' | 7 if g:setting != '' |
11 call complete(col('.'), g:months) | 10 call complete(col('.'), g:months) |
12 return '' | 11 return '' |
13 endfunc | 12 endfunc |
14 | 13 |
15 func! Test_popup_completion_insertmode() | 14 func! Test_popup_completion_insertmode() |
16 new | 15 new |
17 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') | 16 inoremap <F5> <C-R>=ListMonths()<CR> |
18 call assert_equal('February', getline(1)) | 17 |
19 %d | 18 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') |
20 let g:setting = 'noinsertmode' | 19 call assert_equal('February', getline(1)) |
21 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') | 20 %d |
22 call assert_equal('February', getline(1)) | 21 let g:setting = 'noinsertmode' |
23 call assert_false(pumvisible()) | 22 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') |
24 %d | 23 call assert_equal('February', getline(1)) |
25 let g:setting = '' | 24 call assert_false(pumvisible()) |
26 call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx') | 25 %d |
27 call assert_equal('', getline(1)) | 26 let g:setting = '' |
28 %d | 27 call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx') |
29 call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx') | 28 call assert_equal('', getline(1)) |
30 call assert_equal('', getline(1)) | 29 %d |
31 %d | 30 call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx') |
32 call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx') | 31 call assert_equal('', getline(1)) |
33 call assert_equal('December', getline(1)) | 32 %d |
34 bwipe! | 33 call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx') |
34 call assert_equal('December', getline(1)) | |
35 | |
36 bwipe! | |
37 iunmap <F5> | |
35 endfunc | 38 endfunc |
39 | |
40 function! ComplTest() abort | |
41 call complete(1, ['source', 'soundfold']) | |
42 return '' | |
43 endfunction | |
44 | |
45 func Test_noinsert_complete() | |
46 new | |
47 set completeopt+=noinsert | |
48 inoremap <F5> <C-R>=ComplTest()<CR> | |
49 call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx') | |
50 call assert_equal('soundfold', getline(1)) | |
51 call assert_equal('soundfold', getline(2)) | |
52 | |
53 bwipe! | |
54 set completeopt-=noinsert | |
55 iunmap <F5> | |
56 endfunc |