fix(cmdline): fix inconsistent behavior with ext_popupmenu (#35688)

This commit is contained in:
zeertzjq
2025-09-09 08:11:13 +08:00
committed by GitHub
parent acb99b8a65
commit 7f2298ad32
3 changed files with 108 additions and 15 deletions

View File

@@ -454,7 +454,7 @@ local function test_cmdline(linegrid)
}
end)
it('works together with ext_popupmenu', function()
local function test_ext_cmdline_popupmenu()
local expected = {
{ 'define', '', '', '' },
{ 'jump', '', '', '' },
@@ -557,19 +557,63 @@ local function test_cmdline(linegrid)
{1:~ }|*3
|
]],
cmdline = {
{
content = { { 'e wildpum/Xnamedir/XdirA/' } },
firstc = ':',
pos = 25,
},
},
cmdline = { { content = { { 'e wildpum/Xnamedir/XdirA/' } }, firstc = ':', pos = 25 } },
popupmenu = {
anchor = { -1, 0, 19 },
items = { { 'XdirA/', '', '', '' }, { 'XfileA', '', '', '' } },
pos = 0,
},
}
feed('<Esc>')
command('set wildmode=longest,full')
feed(':sign u<tab>')
screen:expect {
grid = [[
^ |
{1:~ }|*3
|
]],
cmdline = { { content = { { 'sign un' } }, firstc = ':', pos = 7 } },
}
feed('<tab>')
local s_undefine_unplace_0 = {
grid = [[
^ |
{1:~ }|*3
|
]],
cmdline = { { content = { { 'sign undefine' } }, firstc = ':', pos = 13 } },
popupmenu = {
anchor = { -1, 0, 5 },
items = { { 'undefine', '', '', '' }, { 'unplace', '', '', '' } },
pos = 0,
},
}
screen:expect(s_undefine_unplace_0)
feed('<Esc>')
screen:expect([[
^ |
{1:~ }|*3
|
]])
feed(':sign un<tab>')
screen:expect(s_undefine_unplace_0)
end
describe('works together with ext_popupmenu', function()
it('with wildoptions=pum', function()
command('set wildoptions=pum')
test_ext_cmdline_popupmenu()
end)
it('with wildoptions=', function()
command('set wildoptions=')
test_ext_cmdline_popupmenu()
end)
end)
it('ext_wildmenu takes precedence over ext_popupmenu', function()