File tree 1 file changed +20
-1
lines changed 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1202,7 +1202,26 @@ def _leave_menu():
1202
1202
# Jump to parent menu
1203
1203
parent = _parent_menu (_cur_menu )
1204
1204
_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
+
1206
1225
_cur_menu = parent
1207
1226
1208
1227
# Try to make the menu entry appear on the same row on the screen as it did
You can’t perform that action at this time.
0 commit comments