From 17d7c1e38f0380ea63784f438bd7ec2625f299b4 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 25 Aug 2018 01:14:19 +0200 Subject: menuconfig: Show all symbols at each menu location for multi.def. choices For named choices defined in multiple locations, show the symbols from all locations, regardless of via which menu node the choice is entered. Named choices with symbols in more than one location are broken in the C tools, so there's no reference for the behavior here. This behavior probably makes more sense than just showing the choice symbols at the current location at least, which was the old behavior in Kconfiglib's menuconfig. Suggested by Mitja Horvat (pinkfluid). --- menuconfig.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'menuconfig.py') diff --git a/menuconfig.py b/menuconfig.py index fd34eb7..fca3cf3 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -987,7 +987,24 @@ def _shown_nodes(menu): node = node.next - rec(menu.list) + if isinstance(menu.item, Choice): + # For named choices defined in multiple locations, entering the choice + # at a particular menu node would normally only show the choice symbols + # defined there (because that's what the MenuNode tree looks like). + # + # That might look confusing, and makes extending choices by defining + # them in multiple locations less useful. Instead, gather all the child + # menu nodes for all the choices whenever a choice is entered. That + # makes all choice symbols visible at all locations. + # + # Choices can contain non-symbol items (people do all sorts of weird + # stuff with them), hence the generality here. We really need to + # preserve the menu tree at each choice location. + for node in menu.item.nodes: + rec(node.list) + else: + rec(menu.list) + return res def _change_node(node): -- cgit v1.2.3