From caa8c06bae0ff351edb22d566a92a4b1009f191d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 02:36:46 +0200 Subject: 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 --- src/nvim/testdir/test_popup.vim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/nvim/testdir') 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\", 'tx') + call assert_equal({'completed_item': {}, 'width': 15, + \ 'height': 2, 'size': 2, + \ 'col': 0, 'row': 4, 'scrollbar': v:false}, g:event) + call feedkeys("a\\\", 'tx') + call assert_equal('foo', g:word) + call feedkeys("a\\\\", 'tx') + call assert_equal('foobar', g:word) + call feedkeys("a\\\\\", 'tx') + call assert_equal(v:null, g:word) + call feedkeys("a\\\\\", 'tx') + call assert_equal('foobar', g:word) + + autocmd! AAAAA_Group + set complete& completeopt& + delfunc! OnPumchange + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit