don't consume 3 digits for a colour code when the first char is 0 and the second

two chars make up a valid colour code (src.utils.irc)
This commit is contained in:
jesopo 2019-01-13 01:54:02 +00:00
parent 9ab9400b46
commit 97b7249989

View file

@ -159,12 +159,14 @@ def _color_tokens(s: str) -> typing.List[str]:
for char in s:
if is_color:
can_add = char.isdigit()
if can_add:
current_color = background if is_background else foreground
can_add = False
current_color = background if is_background else foreground
if char.isdigit() and len(current_color) < 2:
if current_color:
next_color = int(current_color + char)
can_add = next_color <= 15 or next_color == 99
else:
can_add = True
if can_add:
if is_background: