mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
fix(menu): fix listing of submenus (#34315)
Problem: Listing submenus with :menu doesn't work.
Solution: Don't go to the parent of the return value of find_menu(), and
handle empty path at the caller.
Related #8194, which actually only fixed the problem for menu_get(), not
for :menu Ex command.
(cherry picked from commit 5e470c7af5
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
25a869a097
commit
f7b1b0595d
@@ -59,26 +59,80 @@ describe(':emenu', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
local test_menus_cmd = [=[
|
||||
aunmenu *
|
||||
|
||||
nnoremenu &Test.Test inormal<ESC>
|
||||
inoremenu Test.Test insert
|
||||
vnoremenu Test.Test x
|
||||
cnoremenu Test.Test cmdmode
|
||||
menu Test.Nested.test level1
|
||||
menu Test.Nested.Nested2 level2
|
||||
|
||||
nnoremenu <script> Export.Script p
|
||||
tmenu Export.Script This is the tooltip
|
||||
menu ]Export.hidden thisoneshouldbehidden
|
||||
|
||||
nnoremenu Edit.Paste p
|
||||
cnoremenu Edit.Paste <C-R>"
|
||||
]=]
|
||||
|
||||
describe(':menu listing', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
command(test_menus_cmd)
|
||||
end)
|
||||
|
||||
it('matches by path argument', function()
|
||||
eq(
|
||||
[[
|
||||
--- Menus ---
|
||||
500 Edit
|
||||
500 Paste
|
||||
c* <C-R>"]],
|
||||
n.exec_capture('cmenu Edit')
|
||||
)
|
||||
eq(
|
||||
[[
|
||||
--- Menus ---
|
||||
500 &Test
|
||||
500 Test
|
||||
n* inormal<Esc>
|
||||
500 Nested
|
||||
500 test
|
||||
n level1
|
||||
500 Nested2
|
||||
n level2]],
|
||||
n.exec_capture('nmenu Test')
|
||||
)
|
||||
eq(
|
||||
[[
|
||||
--- Menus ---
|
||||
500 Nested
|
||||
500 test
|
||||
o level1
|
||||
500 Nested2
|
||||
o level2]],
|
||||
n.exec_capture('omenu Test.Nested')
|
||||
)
|
||||
eq(
|
||||
[[
|
||||
--- Menus ---
|
||||
500 Test
|
||||
n* inormal<Esc>
|
||||
v* x
|
||||
s* x
|
||||
i* insert
|
||||
c* cmdmode]],
|
||||
n.exec_capture('amenu Test.Test')
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('menu_get', function()
|
||||
before_each(function()
|
||||
clear()
|
||||
command([=[
|
||||
aunmenu *
|
||||
|
||||
nnoremenu &Test.Test inormal<ESC>
|
||||
inoremenu Test.Test insert
|
||||
vnoremenu Test.Test x
|
||||
cnoremenu Test.Test cmdmode
|
||||
menu Test.Nested.test level1
|
||||
menu Test.Nested.Nested2 level2
|
||||
|
||||
nnoremenu <script> Export.Script p
|
||||
tmenu Export.Script This is the tooltip
|
||||
menu ]Export.hidden thisoneshouldbehidden
|
||||
|
||||
nnoremenu Edit.Paste p
|
||||
cnoremenu Edit.Paste <C-R>"
|
||||
]=])
|
||||
command(test_menus_cmd)
|
||||
end)
|
||||
|
||||
it("path='', modes='a'", function()
|
||||
|
Reference in New Issue
Block a user