aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-07-29 02:36:46 +0200
committerGitHub <noreply@github.com>2019-07-29 02:36:46 +0200
commitcaa8c06bae0ff351edb22d566a92a4b1009f191d (patch)
tree69052a0f25d5b6e9207dacbec2da568866cac92d /src/nvim/testdir
parent505f47403ba6a95179ae854c80db07ae77d70947 (diff)
downloadrneovim-caa8c06bae0ff351edb22d566a92a4b1009f191d.tar.gz
rneovim-caa8c06bae0ff351edb22d566a92a4b1009f191d.tar.bz2
rneovim-caa8c06bae0ff351edb22d566a92a4b1009f191d.zip
vim-patch:8.1.1138: add CompleteChanged #10644
(This was originally a Neovim patch, but this commit merges some changes from the Vim patch.) https://github.com/vim/vim/commit/d7f246c68cfb97406bcd4b098a2df2d870b3ef92
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_popup.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim
index 557f60751c..98e9de9ffb 100644
--- a/src/nvim/testdir/test_popup.vim
+++ b/src/nvim/testdir/test_popup.vim
@@ -841,4 +841,38 @@ func Test_popup_complete_info_02()
bwipe!
endfunc
+func Test_CompleteChanged()
+ new
+ call setline(1, ['foo', 'bar', 'foobar', ''])
+ 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
+ augroup AAAAA_Group
+ au!
+ autocmd CompleteChanged * :call OnPumChange()
+ augroup END
+ call cursor(4, 1)
+
+ call feedkeys("Sf\<C-N>", 'tx')
+ call assert_equal({'completed_item': {}, 'width': 15,
+ \ 'height': 2, 'size': 2,
+ \ 'col': 0, 'row': 4, 'scrollbar': v:false}, g:event)
+ call feedkeys("a\<C-N>\<C-N>\<C-E>", 'tx')
+ call assert_equal('foo', g:word)
+ call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-E>", 'tx')
+ call assert_equal('foobar', g:word)
+ call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-E>", 'tx')
+ call assert_equal(v:null, g:word)
+ call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
+ call assert_equal('foobar', g:word)
+
+ autocmd! AAAAA_Group
+ set complete& completeopt&
+ delfunc! OnPumchange
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab