aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-01-17 08:38:58 +0800
committerGitHub <noreply@github.com>2025-01-17 08:38:58 +0800
commit0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18 (patch)
treefa25b2ada0e41c1084cb3f40f6e3025c52b07cb7 /test
parentbf098c12e3078df49fd7dee5ba7c2100a211d4c8 (diff)
downloadrneovim-0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18.tar.gz
rneovim-0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18.tar.bz2
rneovim-0d3a8e8c1a7778c6c79658f26ba492a5f4a17d18.zip
vim-patch:9.1.1020: no way to get current selected item in a async context (#32056)
Problem: no way to get current selected item in a async context Solution: add completed flag to show the entries of currently selected index item (glepnir) closes: vim/vim#16451 https://github.com/vim/vim/commit/037b028a2219d09bc97be04b300b2c0490c4268d Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_ins_complete.vim30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/old/testdir/test_ins_complete.vim b/test/old/testdir/test_ins_complete.vim
index 52fd24881c..f1ff45ff90 100644
--- a/test/old/testdir/test_ins_complete.vim
+++ b/test/old/testdir/test_ins_complete.vim
@@ -2914,4 +2914,34 @@ func Test_complete_info_matches()
set cot&
endfunc
+func Test_complete_info_completed()
+ func ShownInfo()
+ let g:compl_info = complete_info(['completed'])
+ return ''
+ endfunc
+ set completeopt+=noinsert
+
+ new
+ call setline(1, ['aaa', 'aab', 'aba', 'abb'])
+ inoremap <buffer><F5> <C-R>=ShownInfo()<CR>
+
+ call feedkeys("Go\<C-X>\<C-N>\<F5>\<Esc>dd", 'tx')
+ call assert_equal({'word': 'aaa', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, g:compl_info['completed'])
+
+ call feedkeys("Go\<C-X>\<C-N>\<C-N>\<F5>\<Esc>dd", 'tx')
+ call assert_equal({'word': 'aab', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, g:compl_info['completed'])
+
+ call feedkeys("Go\<C-X>\<C-N>\<C-N>\<C-N>\<C-N>\<F5>\<Esc>dd", 'tx')
+ call assert_equal({'word': 'abb', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}, g:compl_info['completed'])
+
+ set completeopt+=noselect
+ call feedkeys("Go\<C-X>\<C-N>\<F5>\<Esc>dd", 'tx')
+ call assert_equal({}, g:compl_info)
+
+ bw!
+ bw!
+ delfunc ShownInfo
+ set cot&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab nofoldenable