Skip to content

Commit 110688d

Browse files
Merge pull request #1 from MrKevinWeiss/pr/menuconfigfix
fix(menuconfig): allow choice override menuconfig
2 parents 061e71f + b8ac100 commit 110688d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

menuconfig.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,26 @@ 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+
try:
1207+
_sel_node_i = _shown.index(_cur_menu)
1208+
except ValueError:
1209+
# Since we can have choice overrides sprinkled throughout the tree
1210+
# we must handle the case of a overridden choice symbol containing
1211+
# a menuconfig.
1212+
# Simply taking the parent of the overridden choice symbol will not
1213+
# be able to navigate back, thus, not able to figure out the index.
1214+
# Insead we have to look in the items for the choice override with
1215+
# the prompt to go back to that location.
1216+
for node in _cur_menu.item.nodes:
1217+
try:
1218+
parent = _parent_menu(node)
1219+
_shown = _shown_nodes(parent)
1220+
_sel_node_i = _shown.index(node)
1221+
break
1222+
except ValueError:
1223+
pass
1224+
12061225
_cur_menu = parent
12071226

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

0 commit comments

Comments
 (0)