From 97b7249989980510a8a99636e3e679e4d7c2b25f Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 13 Jan 2019 01:54:02 +0000 Subject: 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) --- src/utils/irc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/utils') diff --git a/src/utils/irc.py b/src/utils/irc.py index e2b2cf19..1cfe4fcc 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -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: -- cgit v1.3.1-10-gc9f91