frobar: Fix ramp doubles on 1.0
This commit is contained in:
parent
c4fdd50a61
commit
04a08faa7f
|
@ -50,7 +50,10 @@ def ramp(p: float, states: str = " ▁▂▃▄▅▆▇█") -> str:
|
|||
if p < 0:
|
||||
return ""
|
||||
d, m = divmod(p, 1.0)
|
||||
return states[-1] * int(d) + states[round(m * (len(states) - 1))]
|
||||
text = states[-1] * int(d)
|
||||
if m > 0:
|
||||
text += states[round(m * (len(states) - 1))]
|
||||
return text
|
||||
|
||||
|
||||
def clip(text: str, length: int = 30) -> str:
|
||||
|
|
Loading…
Reference in a new issue