0
0
mirror of https://github.com/vim/vim.git synced 2025-10-25 09:04:09 -04:00

patch 9.1.1676: completion: long line shown twice

Problem:  completion: long line shown twice
          (Maxim Kim)
Solution: Fix the issue, disable an incorrect test.
          (Girish Palya)

fixes: #18035
closes: #18088

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-08-23 17:11:18 +02:00
committed by Christian Brabandt
parent e06d81fe67
commit 57379302aa
8 changed files with 86 additions and 41 deletions

View File

@@ -0,0 +1,8 @@
| +0&#ffffff0@59
|~+0#4040ff13&| @58
|~| @58
|~| @58
|~| @58
|~| @58
|~| @10| +0#0000001#ffd7ff255|l|o@15|n|g| |q|u|i|t|e| |l|o@11|n|g|,| |r|e|a|l
|:+0#0000000#ffffff0|D|o|u|b|l|e|E|n|t|r|y| > @46

View File

@@ -0,0 +1,8 @@
|~+0#4040ff13#ffffff0| @58
|~| @58
|~| @58
|~| @58
|~| @10| +0#0000001#e0e0e08|l|o@15|n|g| |q|u|i|t|e| |l|o@11|n|g|,| |r|e|a|l
|:+0#0000000#ffffff0|D|o|u|b|l|e|E|n|t|r|y| |l|o@15|n|g| |q|u|i|t|e| |l|o@11|n|g|,| |r|e|a|l
@1|y| |l|o@11|n|g|,| |p|r|o|b|a|b|l|y| |t|o@1| |l|o@25
@1|n|g| |e|n|t|r|y> @50

View File

@@ -0,0 +1,8 @@
|~+0#4040ff13#ffffff0| @58
|~| @58
|~| @58
|~| @58
|~| @10| +0#0000001#ffd7ff255|l|o@15|n|g| |q|u|i|t|e| |l|o@11|n|g|,| |r|e|a|l
|:+0#0000000#ffffff0|D|o|u|b|l|e|E|n|t|r|y| > @46
@60
@60

View File

@@ -2267,8 +2267,11 @@ func Wildmode_tests()
" when using longest completion match, matches shorter than the argument
" should be ignored (happens with :help)
set wildmode=longest,full
call feedkeys(":help a*\t\<C-B>\"\<CR>", 'xt')
call assert_equal('"help a', @:)
" XXX: This test is incorrect. ':help a*' will never yield 'help a'
" because '`a' exists as a menu item. The intent was to test a case
" handled by nextwild().
" call feedkeys(":help a*\t\<C-B>\"\<CR>", 'xt')
" call assert_equal('"help a', @:)
" non existing file
call feedkeys(":e a1b2y3z4\t\<C-B>\"\<CR>", 'xt')
call assert_equal('"e a1b2y3z4', @:)
@@ -4351,7 +4354,7 @@ func Test_cmdcomplete_info()
call feedkeys(":h echom\<cr>", "tx") " No expansion
call assert_equal('{}', g:cmdcomplete_info)
call feedkeys($":h echoms{trig}\<cr>", "tx")
call assert_equal('{''cmdline_orig'': '''', ''pum_visible'': 0, ''matches'': [], ''selected'': 0}', g:cmdcomplete_info)
call assert_equal('{''cmdline_orig'': ''h echoms'', ''pum_visible'': 0, ''matches'': [], ''selected'': 0}', g:cmdcomplete_info)
call feedkeys($":h echom{trig}\<cr>", "tx")
call assert_equal(
\ '{''cmdline_orig'': ''h echom'', ''pum_visible'': 0, ''matches'': ['':echom'', '':echomsg''], ''selected'': 0}',
@@ -4367,7 +4370,7 @@ func Test_cmdcomplete_info()
set wildoptions=pum
call feedkeys($":h echoms{trig}\<cr>", "tx")
call assert_equal('{''cmdline_orig'': '''', ''pum_visible'': 0, ''matches'': [], ''selected'': 0}', g:cmdcomplete_info)
call assert_equal('{''cmdline_orig'': ''h echoms'', ''pum_visible'': 0, ''matches'': [], ''selected'': 0}', g:cmdcomplete_info)
call feedkeys($":h echom{trig}\<cr>", "tx")
call assert_equal(
\ '{''cmdline_orig'': ''h echom'', ''pum_visible'': 1, ''matches'': ['':echom'', '':echomsg''], ''selected'': 0}',
@@ -4864,7 +4867,6 @@ endfunc
" file paths when 'noselect' is present.
func Test_noselect_expand_env_var()
CheckScreendump
let lines =<< trim [SCRIPT]
set wildmenu wildoptions=pum wildmode=noselect,full
let $TESTDIR = 'a/b'
@@ -4889,4 +4891,31 @@ func Test_noselect_expand_env_var()
call StopVimInTerminal(buf)
endfunc
" Issue #18035: long lines should not get listed twice in the menu when
" 'wildmode' contains 'noselect'
func Test_long_line_noselect()
CheckScreendump
let lines =<< trim [SCRIPT]
set wildmenu wildoptions=pum wildmode=noselect,full
command -nargs=1 -complete=custom,Entries DoubleEntry echo
func Entries(a, b, c)
return 'loooooooooooooooong quite loooooooooooong, really loooooooooooong, probably too looooooooooooooooooooooooooong entry'
endfunc
[SCRIPT]
call writefile(lines, 'XTest_wildmenu', 'D')
let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8, 'cols': 60})
call term_sendkeys(buf, ":DoubleEntry \<Tab>")
call VerifyScreenDump(buf, 'Test_long_line_noselect_1', {})
call term_sendkeys(buf, "\<Esc>:DoubleEntry \<Tab>\<C-N>")
call VerifyScreenDump(buf, 'Test_long_line_noselect_2', {})
call term_sendkeys(buf, "\<Esc>:DoubleEntry \<Tab>\<C-N>\<C-N>")
call VerifyScreenDump(buf, 'Test_long_line_noselect_3', {})
" clean up
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab