diff options
| author | 2019-03-06 21:48:31 +0000 | |
|---|---|---|
| committer | 2019-03-06 21:48:31 +0000 | |
| commit | 6b59830a6ea4e22796bff658d5c10a58d4695b2b (patch) | |
| tree | 01af78855f86443b4c93e98df6569abcadb55456 /src/utils/irc | |
| parent | Log content of lines that need fallback encoding (diff) | |
| signature | ||
Only print ANSI reset characters when appropriate
Diffstat (limited to 'src/utils/irc')
| -rw-r--r-- | src/utils/irc/__init__.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/utils/irc/__init__.py b/src/utils/irc/__init__.py index 381e3116..d2897deb 100644 --- a/src/utils/irc/__init__.py +++ b/src/utils/irc/__init__.py @@ -212,7 +212,16 @@ def parse_format(s: str) -> str: s = s.replace(token, replace, 1) - return s + utils.consts.ANSI_RESET + if has_foreground: + s += utils.consts.ANSI_FOREGROUND_RESET + if has_background: + s += utils.consts.ANSI_BACKGROUND_RESET + if bold: + s += utils.consts.ANSI_BOLD_RESET + if underline: + s += utils.consts.ANSI_UNDERLINE_RESET + + return s OPT_STR = typing.Optional[str] class IRCConnectionParameters(object): |
