Mercurial > vim
annotate 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 |
rev | line source |
---|---|
9359
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test for completion menu |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 let g:setting = '' |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func ListMonths() |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 if g:setting != '' |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 exe ":set" g:setting |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 endif |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call complete(col('.'), g:months) |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 return '' |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 endfunc |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 func! Test_popup_completion_insertmode() |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
15 new |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
16 inoremap <F5> <C-R>=ListMonths()<CR> |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
17 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
18 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
19 call assert_equal('February', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
20 %d |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
21 let g:setting = 'noinsertmode' |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
22 call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
23 call assert_equal('February', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
24 call assert_false(pumvisible()) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
25 %d |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
26 let g:setting = '' |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
27 call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
28 call assert_equal('', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
29 %d |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
30 call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
31 call assert_equal('', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
32 %d |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
33 call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
34 call assert_equal('December', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
35 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
36 bwipe! |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
37 iunmap <F5> |
9359
35b173e37dc6
commit https://github.com/vim/vim/commit/00672e1d3f59dbff91a18d418b2984be96f89ee5
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 endfunc |
9465
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
39 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
40 function! ComplTest() abort |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
41 call complete(1, ['source', 'soundfold']) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
42 return '' |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
43 endfunction |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
44 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
45 func Test_noinsert_complete() |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
46 new |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
47 set completeopt+=noinsert |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
48 inoremap <F5> <C-R>=ComplTest()<CR> |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
49 call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx') |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
50 call assert_equal('soundfold', getline(1)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
51 call assert_equal('soundfold', getline(2)) |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
52 |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
53 bwipe! |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
54 set completeopt-=noinsert |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
55 iunmap <F5> |
203792348947
commit https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7
Christian Brabandt <cb@256bit.org>
parents:
9359
diff
changeset
|
56 endfunc |