From 66a2bf5136945881af3956a6c50475b7dce5a2f7 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 29 Aug 2018 09:19:16 +0200 Subject: menuconfig: Do not use red for invisible symbols outside of show-all mode Invisible symbols can show up outside show-all mode if an invisible symbol has visible symbols in an implicit (indented) submenu. Printing them in red like in show-all mode is the perfectly consistent thing to do, but might look confusing/broken. Only print invisible symbols in red in show-all mode. Also change the bracket style for all invisible bool/tristate symbols to - - N_SYM -M- M_SYM -*- Y_SYM That makes it clear that they can't be changed, even when they show up outside show-all mode, and makes logical sense if that style is taken to always mean that the symbol value can't be changed. You lose a quick reference for whether a symbol is a bool or tristate, but it's not a huge deal. --- menuconfig.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index a8053f1..392bc1b 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -969,7 +969,11 @@ def _draw_main(): node = _shown[i] - if node.prompt and expr_value(node.prompt[1]): + # The 'not _show_all' test avoids showing invisible items in red + # outside show-all mode, which could look confusing/broken. Invisible + # symbols show up outside show-all mode if an invisible symbol has + # visible children in an implicit (indented) menu. + if not _show_all or (node.prompt and expr_value(node.prompt[1])): style = _LIST_SEL_STYLE if i == _sel_node_i else _LIST_STYLE else: style = _LIST_INVISIBLE_SEL_STYLE if i == _sel_node_i else \ @@ -2397,7 +2401,7 @@ def _value_str(node): tri_val_str = (" ", "M", "*")[item.tri_value] - if len(item.assignable) == 1: + if len(item.assignable) <= 1: # Pinned to a single value return "" if isinstance(item, Choice) else "-{}-".format(tri_val_str) -- cgit v1.2.3