From fae2e70a894dc7b6ba625e11788f726d6a4d27a2 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 13 Oct 2018 17:32:27 +0200 Subject: menuconfig: Do not show range hint for symbols without ranges The 'no range constraints' input dialog hint for int/hex symbols might be more confusing than helpful, especially if you assume it was something the symbol author put there. Only show the range hint for symbols with active ranges instead, and show nothing for other symbols. --- menuconfig.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'menuconfig.py') diff --git a/menuconfig.py b/menuconfig.py index b3b240c..7801897 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -2779,16 +2779,14 @@ def _check_validity(sym, s): def _range_info(sym): # Returns a string with information about the valid range for the symbol - # 'sym', or None if 'sym' isn't an int/hex symbol + # 'sym', or None if 'sym' doesn't have a range - if sym.type not in (INT, HEX): - return None - - for low, high, cond in sym.ranges: - if expr_value(cond): - return "Range: {}-{}".format(low.str_value, high.str_value) + if sym.type in (INT, HEX): + for low, high, cond in sym.ranges: + if expr_value(cond): + return "Range: {}-{}".format(low.str_value, high.str_value) - return "No range constraints." + return None def _is_num(name): # Heuristic to see if a symbol name looks like a number, for nicer output -- cgit v1.2.3