diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-26 02:34:23 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-08-26 03:04:30 +0200 |
| commit | ddfd5df84b4b7871ea16d76e233c11c8b45738d9 (patch) | |
| tree | 368dc5d2b39520c0650d09e3506986cddbc1d59c /kconfiglib.py | |
| parent | 2320b7adb703c22e44ec9716a0d2605e80a02783 (diff) | |
Improve menu structure for promptless choices
Promptless choices can appear "legitimately" if you define a named
choice in multiple locations to add on some symbols (which is broken in
the C tools though).
Prior to this fix, the promptless choice would get flattened, with the
choice symbols appearing in the same menu as the (invisible) choice.
This looks confusing.
Skip flattening promptless choices to fix it.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 38bdff2..3d2c82a 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -5389,9 +5389,16 @@ def _flatten(node): # symbols with children from automatic menu creation) so that their # children appear after them instead. This gives a clean menu structure # with no unexpected "jumps" in the indentation. + # + # Do not flatten promptless choices (which can appear "legitimitely" if a + # named choice is defined in multiple locations to add on symbols). It + # looks confusing, and the menuconfig already shows all choice symbols if + # you enter the choice at some location with a prompt. while node: - if node.list and not node.prompt: + if node.list and not node.prompt and \ + not isinstance(node.item, Choice): + last_node = node.list while 1: last_node.parent = node.parent |
