@@ -2267,8 +2267,11 @@ func Wildmode_tests()
22672267 " when using longest completion match, matches shorter than the argument
22682268 " should be ignored (happens with :help)
22692269 set wildmode = longest,full
2270- call feedkeys (" :help a*\t \<C-B> \" \<CR> " , ' xt' )
2271- call assert_equal (' "help a' , @: )
2270+ " XXX: This test is incorrect. ':help a*' will never yield 'help a'
2271+ " because '`a' exists as a menu item. The intent was to test a case
2272+ " handled by nextwild().
2273+ " call feedkeys(":help a*\t\<C-B>\"\<CR>", 'xt')
2274+ " call assert_equal('"help a', @:)
22722275 " non existing file
22732276 call feedkeys (" :e a1b2y3z4\t \<C-B> \" \<CR> " , ' xt' )
22742277 call assert_equal (' "e a1b2y3z4' , @: )
@@ -4351,7 +4354,7 @@ func Test_cmdcomplete_info()
43514354 call feedkeys (" :h echom\<cr> " , " tx" ) " No expansion
43524355 call assert_equal (' {}' , g: cmdcomplete_info )
43534356 call feedkeys ($ " :h echoms{trig}\<cr> " , " tx" )
4354- call assert_equal (' {'' cmdline_orig'' : '''' , '' pum_visible'' : 0, '' matches'' : [], '' selected'' : 0}' , g: cmdcomplete_info )
4357+ call assert_equal (' {'' cmdline_orig'' : '' h echoms '' , '' pum_visible'' : 0, '' matches'' : [], '' selected'' : 0}' , g: cmdcomplete_info )
43554358 call feedkeys ($ " :h echom{trig}\<cr> " , " tx" )
43564359 call assert_equal (
43574360 \ ' {'' cmdline_orig'' : '' h echom'' , '' pum_visible'' : 0, '' matches'' : ['' :echom'' , '' :echomsg'' ], '' selected'' : 0}' ,
@@ -4367,7 +4370,7 @@ func Test_cmdcomplete_info()
43674370
43684371 set wildoptions = pum
43694372 call feedkeys ($ " :h echoms{trig}\<cr> " , " tx" )
4370- call assert_equal (' {'' cmdline_orig'' : '''' , '' pum_visible'' : 0, '' matches'' : [], '' selected'' : 0}' , g: cmdcomplete_info )
4373+ call assert_equal (' {'' cmdline_orig'' : '' h echoms '' , '' pum_visible'' : 0, '' matches'' : [], '' selected'' : 0}' , g: cmdcomplete_info )
43714374 call feedkeys ($ " :h echom{trig}\<cr> " , " tx" )
43724375 call assert_equal (
43734376 \ ' {'' cmdline_orig'' : '' h echom'' , '' pum_visible'' : 1, '' matches'' : ['' :echom'' , '' :echomsg'' ], '' selected'' : 0}' ,
@@ -4864,7 +4867,6 @@ endfunc
48644867" file paths when 'noselect' is present.
48654868func Test_noselect_expand_env_var ()
48664869 CheckScreendump
4867-
48684870 let lines = << trim [SCRIPT]
48694871 set wildmenu wildoptions = pum wildmode = noselect,full
48704872 let $TESTDIR = ' a/b'
@@ -4889,4 +4891,31 @@ func Test_noselect_expand_env_var()
48894891 call StopVimInTerminal (buf )
48904892endfunc
48914893
4894+ " Issue #18035: long lines should not get listed twice in the menu when
4895+ " 'wildmode' contains 'noselect'
4896+ func Test_long_line_noselect ()
4897+ CheckScreendump
4898+ let lines = << trim [SCRIPT]
4899+ set wildmenu wildoptions = pum wildmode = noselect,full
4900+ command -nargs =1 -complete =custom ,Entries DoubleEntry echo
4901+ func Entries (a , b , c )
4902+ return ' loooooooooooooooong quite loooooooooooong, really loooooooooooong, probably too looooooooooooooooooooooooooong entry'
4903+ endfunc
4904+ [SCRIPT]
4905+ call writefile (lines , ' XTest_wildmenu' , ' D' )
4906+ let buf = RunVimInTerminal (' -S XTest_wildmenu' , {' rows' : 8 , ' cols' : 60 })
4907+
4908+ call term_sendkeys (buf , " :DoubleEntry \<Tab> " )
4909+ call VerifyScreenDump (buf , ' Test_long_line_noselect_1' , {})
4910+
4911+ call term_sendkeys (buf , " \<Esc> :DoubleEntry \<Tab>\<C-N> " )
4912+ call VerifyScreenDump (buf , ' Test_long_line_noselect_2' , {})
4913+
4914+ call term_sendkeys (buf , " \<Esc> :DoubleEntry \<Tab>\<C-N>\<C-N> " )
4915+ call VerifyScreenDump (buf , ' Test_long_line_noselect_3' , {})
4916+ " clean up
4917+ call term_sendkeys (buf , " \<Esc> " )
4918+ call StopVimInTerminal (buf )
4919+ endfunc
4920+
48924921" vim: shiftwidth = 2 sts = 2 expandtab
0 commit comments