diff options
| author | Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de> | 2025-10-21 15:41:12 +0200 |
|---|---|---|
| committer | Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no> | 2025-10-21 20:33:24 +0200 |
| commit | 0380400353870974eef82c5ffccd2efb39928370 (patch) | |
| tree | c22932febffb2c8110dae6d3231351cef6f5a24f | |
| parent | c3f78659b886f81b7b5898497c9aa94dc634aef2 (diff) | |
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.
| -rwxr-xr-x | menuconfig.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/menuconfig.py b/menuconfig.py index a0ab004..21b5f54 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -1202,7 +1202,15 @@ def _leave_menu(): # Jump to parent menu parent = _parent_menu(_cur_menu) _shown = _shown_nodes(parent) - _sel_node_i = _shown.index(_cur_menu) + + if _cur_menu in _shown: + _sel_node_i = _shown.index(_cur_menu) + else: + # The current menu is not visible in the parent menu. This can happen + # when a choice with an associated symbol is extended somewhere + # else by an invisible one. In this case, point to node at index 0. + _sel_node_i = 0 + _cur_menu = parent # Try to make the menu entry appear on the same row on the screen as it did |
