Skip to content

Commit 0380400

Browse files
leandrolanzieritejlmand
authored andcommitted
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 c3f7865 commit 0380400

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

menuconfig.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,15 @@ 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)
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
1213+
12061214
_cur_menu = parent
12071215

12081216
# Try to make the menu entry appear on the same row on the screen as it did

0 commit comments

Comments
 (0)