@@ -3387,4 +3387,33 @@ func Test_complete_multiline_marks()
3387
3387
delfunc Omni_test
3388
3388
endfunc
3389
3389
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
+
3390
3419
" vim: shiftwidth = 2 sts = 2 expandtab nofoldenable
0 commit comments