diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2019-04-17 02:06:59 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2019-04-17 03:10:01 +0200 |
| commit | 37c698413ef6f433f03589a4f52076893030a9e5 (patch) | |
| tree | b45fe1568ede8315e8f41bbecfd14f087b10fde7 /menuconfig.py | |
| parent | 8ddc0df484a25f915591c5bee6f4a9e4e71207d5 (diff) | |
menuconfig: Fix display issue for optional-prompt menuconfigs
_shown_nodes() needs to check whether invisible 'menuconfig' symbols
with optional prompts have visible children, so that they can be shown
outside show-all mode. Previously, only 'config' symbols were checked.
Diffstat (limited to 'menuconfig.py')
| -rwxr-xr-x | menuconfig.py | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/menuconfig.py b/menuconfig.py index 1c5e4b2..1a1e052 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -1457,20 +1457,28 @@ def _shown_nodes(menu): res = [] while node: - # If a node has children but doesn't have the is_menuconfig flag - # set, the children come from a submenu created implicitly from - # dependencies, and are shown (indented) in the same menu as the - # parent node - shown_children = \ - rec(node.list) if node.list and not node.is_menuconfig else [] - - # Always show the node if it is the root of an implicit submenu - # with visible items, even if the node itself is invisible. This - # can happen e.g. if the symbol has an optional prompt - # ('prompt "foo" if COND') that is currently invisible. - if _visible(node) or shown_children or _show_all: + # This code is minorly performance-sensitive. Make it too slow + # (e.g., by always recursing the entire tree), and going in and out + # of menus no longer feels instant. + + if _visible(node) or _show_all: res.append(node) - res += shown_children + if node.list and not node.is_menuconfig: + # Nodes from implicit menu created from dependencies. Will + # be shown indented. Note that is_menuconfig is True for + # menus and choices as well as 'menuconfig' symbols. + res += rec(node.list) + + elif node.list and isinstance(node.item, Symbol): + # Show invisible symbols (defined with either 'config' and + # 'menuconfig') if they have visible children. This can happen + # for an m/y-valued symbol with an optional prompt ('prompt + # "foo" is COND') that is currently disabled. + shown_children = rec(node.list) + if shown_children: + res.append(node) + if not node.is_menuconfig: + res += shown_children node = node.next |
