summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-10-13 17:32:27 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-10-13 17:40:53 +0200
commitfae2e70a894dc7b6ba625e11788f726d6a4d27a2 (patch)
tree39a1e5704b40b0f51a832e0f098000b7e8cfd8ca
parentbde4cc71fc01f209e1df0916843d351be201f78e (diff)
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.
-rwxr-xr-xmenuconfig.py14
1 files changed, 6 insertions, 8 deletions
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