diff src/testdir/test_popup.vim @ 16237:56451a2677dc v8.1.1123

patch 8.1.1123: no way to avoid filtering for autocomplete function commit https://github.com/vim/vim/commit/73655cf0ca37a9aa8f56fc51bb853a8b1f7b43d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 6 13:45:55 2019 +0200 patch 8.1.1123: no way to avoid filtering for autocomplete function Problem: No way to avoid filtering for autocomplete function, causing flickering of the popup menu. Solution: Add the "equal" field to complete items. (closes #3887)
author Bram Moolenaar <Bram@vim.org>
date Sat, 06 Apr 2019 14:00:05 +0200
parents 0375e54f0adc
children 0f65f2808470
line wrap: on
line diff
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -276,6 +276,38 @@ func Test_noinsert_complete()
   iunmap <F5>
 endfunc
 
+func Test_complete_no_filter()
+  func! s:complTest1() abort
+    call complete(1, [{'word': 'foobar'}])
+    return ''
+  endfunc
+  func! s:complTest2() abort
+    call complete(1, [{'word': 'foobar', 'equal': 1}])
+    return ''
+  endfunc
+
+  let completeopt = &completeopt
+
+  " without equal=1
+  new
+  set completeopt=menuone,noinsert,menu
+  inoremap <F5>  <C-R>=s:complTest1()<CR>
+  call feedkeys("i\<F5>z\<CR>\<CR>\<ESC>.", 'tx')
+  call assert_equal('z', getline(1))
+  bwipe!
+
+  " with equal=1
+  new
+  set completeopt=menuone,noinsert,menu
+  inoremap <F5>  <C-R>=s:complTest2()<CR>
+  call feedkeys("i\<F5>z\<CR>\<CR>\<ESC>.", 'tx')
+  call assert_equal('foobar', getline(1))
+  bwipe!
+
+  let &completeopt = completeopt
+  iunmap <F5>
+endfunc
+
 func Test_compl_vim_cmds_after_register_expr()
   func! s:test_func()
     return 'autocmd '