mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Fix bugs in wrapping IRC messages.
This commit is contained in:
parent
922012a307
commit
a03a89730a
@ -939,7 +939,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
return m
|
||||
# The '(XX more messages)' may have not the same
|
||||
# length in the current locale
|
||||
allowedLength -= len(_('(XX more messages)'))
|
||||
allowedLength -= len(_('(XX more messages)')) + 1 # bold
|
||||
msgs = ircutils.wrap(s, allowedLength)
|
||||
msgs.reverse()
|
||||
instant = conf.get(conf.supybot.reply.mores.instant,target)
|
||||
|
@ -540,6 +540,10 @@ class FormatContext(object):
|
||||
IRC string."""
|
||||
prefix_size = self.bold + self.reverse + self.underline + \
|
||||
bool(self.fg) + bool(self.bg)
|
||||
if self.fg and self.bg:
|
||||
prefix_size += 6 # '\x03xx,yy%s'
|
||||
elif self.fg or self.bg:
|
||||
prefix_size += 3 # '\x03xx%s'
|
||||
if prefix_size:
|
||||
return prefix_size + 1 # '\x0f'
|
||||
else:
|
||||
|
@ -229,10 +229,8 @@ class FunctionsTestCase(SupyTestCase):
|
||||
|
||||
s = '\x02\x16 barbazqux' + ('foobarbazqux ' * 20)[0:-1]
|
||||
r = ircutils.wrap(s, 91)
|
||||
print(list(map(pred, r)))
|
||||
self.assertTrue(max(map(pred, r)) <= 91)
|
||||
|
||||
|
||||
def testSafeArgument(self):
|
||||
s = 'I have been running for 9 seconds'
|
||||
bolds = ircutils.bold(s)
|
||||
|
Loading…
Reference in New Issue
Block a user