From bd176240d6f6d19b2518b9d371742819e0a39902 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 19 Nov 2019 14:45:47 +0000 Subject: [PATCH] consecutive HASH_STOP chars at start shouldn't count as a stop --- src/utils/irc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/irc.py b/src/utils/irc.py index 55a12df6..cdaa61eb 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -46,8 +46,11 @@ HASH_COLORS = [consts.CYAN, consts.PURPLE, consts.GREEN, consts.ORANGE, consts.LIGHTGREEN, consts.BLUE] def hash_colorize(s: str): hash = 5381 + non_stop = False for i, char in enumerate(s): - if char in HASH_STOP and i > 0: + if not char in HASH_STOP: + non_stop = True + elif non_stop: break hash ^= ((hash<<5)+(hash>>2)+ord(char))&0xFFFFFFFFFFFFFFFF