Skip to content

Commit 0a132f2

Browse files
menuconfig: check if current menu is visible in parent when leaving
This handles a case of leaving a menu which is not shown by the parent menu. This might occur, for instance, when searching for the symbol of a named choice, which is extended by an invisible symbol somewhere else.
1 parent e8e83f0 commit 0a132f2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

menuconfig.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,8 +1202,14 @@ def _leave_menu():
12021202
# Jump to parent menu
12031203
parent = _parent_menu(_cur_menu)
12041204
_shown = _shown_nodes(parent)
1205-
_sel_node_i = _shown.index(_cur_menu)
1206-
_cur_menu = parent
1205+
1206+
if _cur_menu in _shown:
1207+
_sel_node_i = _shown.index(_cur_menu)
1208+
else:
1209+
# The current menu is not visible in the parent menu. This can happen
1210+
# when a choice with an associated symbol is extended somewhere
1211+
# else by an invisible one. In this case, point to node at index 0.
1212+
_sel_node_i = 0
12071213

12081214
# Try to make the menu entry appear on the same row on the screen as it did
12091215
# before we entered the menu.

0 commit comments

Comments
 (0)