aboutsummaryrefslogtreecommitdiff
path: root/src/IRCLine.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-19 10:34:42 +0100
committerGravatar jesopo2019-06-19 10:34:42 +0100
commit938e1db9631a89c2de526e1de21a55b1469da03d (patch)
treeddd2472323fd97650d21763101481a5b39ae5a64 /src/IRCLine.py
parentallow short names for config contexts. people mistook "user" as "put your (diff)
signature
add `margin` arg to ParsedLine.truncate so commands/outs.py doesn't do it
manually and cause potential issues with multi-byte chars
Diffstat (limited to 'src/IRCLine.py')
-rw-r--r--src/IRCLine.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/IRCLine.py b/src/IRCLine.py
index f713eecd..5aae1f53 100644
--- a/src/IRCLine.py
+++ b/src/IRCLine.py
@@ -111,13 +111,13 @@ class ParsedLine(object):
else:
return line
- def _line_max(self, hostmask: str) -> int:
- return LINE_MAX-len((":%s " % hostmask).encode("utf8"))
- def truncate(self, hostmask: str) -> typing.Tuple[str, str]:
+ def _line_max(self, hostmask: str, margin: int) -> int:
+ return LINE_MAX-len((":%s " % hostmask).encode("utf8"))-margin
+ def truncate(self, hostmask: str, margin: int=0) -> typing.Tuple[str, str]:
valid_bytes = b""
valid_index = -1
- line_max = self._line_max(hostmask)
+ line_max = self._line_max(hostmask, margin)
tags_formatted, line_formatted = self._format()
for i, char in enumerate(line_formatted):