diff options
| author | 2019-10-25 17:12:24 +0100 | |
|---|---|---|
| committer | 2019-10-25 17:12:24 +0100 | |
| commit | 3a755bb15fd115f82678ed3e66ecda7ca1a0fe2e (patch) | |
| tree | 069dcec376ca345461f46bb9ae272e73c2a9c42c /src | |
| parent | comma-separate likes/dislikes for youtube videos (diff) | |
| signature | ||
don't consume past 2nd digit in e.g. "\03033,123"
Diffstat (limited to 'src')
| -rw-r--r-- | src/utils/irc/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/irc/__init__.py b/src/utils/irc/__init__.py index bd7c09ec..160d55c2 100644 --- a/src/utils/irc/__init__.py +++ b/src/utils/irc/__init__.py @@ -122,19 +122,19 @@ def _format_tokens(s: str) -> typing.List[str]: for i, char in enumerate(s): last_char = i == len(s)-1 if is_color: - can_add = False current_color = background if is_background else foreground - color_finished = False + color_finished = True if char.isdigit() and len(current_color) < 2: if is_background: background += char else: foreground += char color_finished = (len(current_color)+1) == 2 - - if char == "," and not is_background: + elif char == "," and not is_background: is_background = True - elif not char.isdigit() or (color_finished and last_char): + color_finished = False + + if not char.isdigit() or last_char or color_finished: color = foreground if background: color += ","+background |
