aboutsummaryrefslogtreecommitdiff
path: root/src/utils/irc.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-30 16:30:47 +0000
committerGravatar jesopo2018-11-30 16:30:56 +0000
commit4dfb2ffeaa6a0755d81937a2092c9b1cdf1df5e1 (patch)
tree51960bcc483ba9c63597190561f6beaaf03e80e4 /src/utils/irc.py
parent'find_*_setting' functions don't exist anymore! (diff)
signature
Support ANSI underline
Diffstat (limited to 'src/utils/irc.py')
-rw-r--r--src/utils/irc.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py
index d8609bf9..fa2f44d7 100644
--- a/src/utils/irc.py
+++ b/src/utils/irc.py
@@ -146,7 +146,8 @@ def strip_font(s: str) -> str:
FORMAT_TOKENS = [
utils.consts.BOLD,
- utils.consts.RESET
+ utils.consts.RESET,
+ utils.consts.UNDERLINE
]
def _color_tokens(s: str) -> typing.List[str]:
is_color = False
@@ -205,6 +206,7 @@ def to_ansi_colors(s: str) -> str:
has_foreground = False
has_background = False
bold = False
+ uderline = False
for token in _color_tokens(s):
replace = ""
@@ -238,6 +240,12 @@ def to_ansi_colors(s: str) -> str:
bold = not bold
elif type == utils.consts.RESET:
replace += utils.consts.ANSI_RESET
+ elif type == utils.consts.UNDERLINE:
+ if underline:
+ replace += utils.consts.ANSI_UNDERLINE_RESET
+ else:
+ replace += utils.consts.ANSI_UNDERLINE
+ underline = not underline
s = s.replace(token, replace, 1)