diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-03-16 10:36:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-16 10:36:54 +0100 |
commit | 175398f21645552b708a7626309b826ae0f3d8a8 (patch) | |
tree | 7e7597cd82108f4148d7dc2ef3b3365e78a39e01 /test/functional/viml/completion_spec.lua | |
parent | b90256e6cc2ab22c552660c70462c08ba5fd984b (diff) | |
parent | 6c375d71c3a92b0f83f1756799520ae61d11e64e (diff) | |
download | rneovim-175398f21645552b708a7626309b826ae0f3d8a8.tar.gz rneovim-175398f21645552b708a7626309b826ae0f3d8a8.tar.bz2 rneovim-175398f21645552b708a7626309b826ae0f3d8a8.zip |
Merge pull request #9616 from chemzqm/completechange
add MenuPopupChanged autocmd
Diffstat (limited to 'test/functional/viml/completion_spec.lua')
-rw-r--r-- | test/functional/viml/completion_spec.lua | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index cd1b312265..c84b2c1087 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -1072,4 +1072,83 @@ describe('completion', function() set complete&vim completeopt&vim ]]) end) + + it('MenuPopupChanged autocommand', function() + curbufmeths.set_lines(0, 1, false, { 'foo', 'bar', 'foobar', ''}) + source([[ + set complete=. completeopt=noinsert,noselect,menuone + function! OnPumChange() + let g:event = copy(v:event) + let g:item = get(v:event, 'completed_item', {}) + let g:word = get(g:item, 'word', v:null) + endfunction + autocmd! MenuPopupChanged * :call OnPumChange() + call cursor(4, 1) + ]]) + + feed('Sf<C-N>') + screen:expect([[ + foo | + bar | + foobar | + f^ | + {1:foo }{0: }| + {1:foobar }{0: }| + {0:~ }| + {3:-- Keyword completion (^N^P) }{5:Back at original} | + ]]) + eq({completed_item = {}, width = 15, + height = 2, size = 2, + col = 0, row = 4, scrollbar = false}, + eval('g:event')) + feed('<C-N>') + screen:expect([[ + foo | + bar | + foobar | + foo^ | + {2:foo }{0: }| + {1:foobar }{0: }| + {0:~ }| + {3:-- Keyword completion (^N^P) }{4:match 1 of 2} | + ]]) + eq('foo', eval('g:word')) + feed('<C-N>') + screen:expect([[ + foo | + bar | + foobar | + foobar^ | + {1:foo }{0: }| + {2:foobar }{0: }| + {0:~ }| + {3:-- Keyword completion (^N^P) }{4:match 2 of 2} | + ]]) + eq('foobar', eval('g:word')) + feed('<up>') + screen:expect([[ + foo | + bar | + foobar | + foobar^ | + {2:foo }{0: }| + {1:foobar }{0: }| + {0:~ }| + {3:-- Keyword completion (^N^P) }{4:match 1 of 2} | + ]]) + eq('foo', eval('g:word')) + feed('<down>') + screen:expect([[ + foo | + bar | + foobar | + foobar^ | + {1:foo }{0: }| + {2:foobar }{0: }| + {0:~ }| + {3:-- Keyword completion (^N^P) }{4:match 2 of 2} | + ]]) + eq('foobar', eval('g:word')) + feed('<esc>') + end) end) |