Skip to content

Commit 71f17fd

Browse files
chrisbragirishji
andcommitted
patch 9.1.1265: tests: no tests for typing normal char during completion
Problem: tests: no tests for typing normal char during completion Solution: add a test verifying the default behaviour (see :h popupmenu-completion) related: vim#17019 Co-authored-by: Girish Palya <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 4ac995b commit 71f17fd

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/testdir/test_ins_complete.vim

+29
Original file line numberDiff line numberDiff line change
@@ -3387,4 +3387,33 @@ func Test_complete_multiline_marks()
33873387
delfunc Omni_test
33883388
endfunc
33893389

3390+
func Test_complete_append_selected_match_default()
3391+
" when typing a normal character during completion,
3392+
" completion is ended, see
3393+
" :h popupmenu-completion ("There are three states:")
3394+
func PrintMenuWords()
3395+
let info = complete_info(["selected", "matches"])
3396+
call map(info.matches, {_, v -> v.word})
3397+
return info
3398+
endfunc
3399+
3400+
new
3401+
call setline(1, ["fo", "foo", "foobar", "fobarbaz"])
3402+
exe "normal! Gof\<c-n>\<c-r>=PrintMenuWords()\<cr>"
3403+
call assert_equal('fo{''matches'': [''fo'', ''foo'', ''foobar'', ''fobarbaz''], ''selected'': 0}', getline(5))
3404+
%d
3405+
call setline(1, ["fo", "foo", "foobar", "fobarbaz"])
3406+
exe "normal! Gof\<c-n>o\<c-r>=PrintMenuWords()\<cr>"
3407+
call assert_equal('foo{''matches'': [], ''selected'': -1}', getline(5))
3408+
%d
3409+
set completeopt=menu,noselect
3410+
call setline(1, ["fo", "foo", "foobar", "fobarbaz"])
3411+
exe "normal! Gof\<c-n>\<c-n>o\<c-r>=PrintMenuWords()\<cr>"
3412+
call assert_equal('foo{''matches'': [], ''selected'': -1}', getline(5))
3413+
bw!
3414+
3415+
set completeopt&
3416+
delfunc PrintMenuWords
3417+
endfunc
3418+
33903419
" vim: shiftwidth=2 sts=2 expandtab nofoldenable

src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1265,
707709
/**/
708710
1264,
709711
/**/

0 commit comments

Comments
 (0)