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
|
return m
|
||||||
# The '(XX more messages)' may have not the same
|
# The '(XX more messages)' may have not the same
|
||||||
# length in the current locale
|
# length in the current locale
|
||||||
allowedLength -= len(_('(XX more messages)'))
|
allowedLength -= len(_('(XX more messages)')) + 1 # bold
|
||||||
msgs = ircutils.wrap(s, allowedLength)
|
msgs = ircutils.wrap(s, allowedLength)
|
||||||
msgs.reverse()
|
msgs.reverse()
|
||||||
instant = conf.get(conf.supybot.reply.mores.instant,target)
|
instant = conf.get(conf.supybot.reply.mores.instant,target)
|
||||||
|
@ -540,6 +540,10 @@ class FormatContext(object):
|
|||||||
IRC string."""
|
IRC string."""
|
||||||
prefix_size = self.bold + self.reverse + self.underline + \
|
prefix_size = self.bold + self.reverse + self.underline + \
|
||||||
bool(self.fg) + bool(self.bg)
|
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:
|
if prefix_size:
|
||||||
return prefix_size + 1 # '\x0f'
|
return prefix_size + 1 # '\x0f'
|
||||||
else:
|
else:
|
||||||
|
@ -229,10 +229,8 @@ class FunctionsTestCase(SupyTestCase):
|
|||||||
|
|
||||||
s = '\x02\x16 barbazqux' + ('foobarbazqux ' * 20)[0:-1]
|
s = '\x02\x16 barbazqux' + ('foobarbazqux ' * 20)[0:-1]
|
||||||
r = ircutils.wrap(s, 91)
|
r = ircutils.wrap(s, 91)
|
||||||
print(list(map(pred, r)))
|
|
||||||
self.assertTrue(max(map(pred, r)) <= 91)
|
self.assertTrue(max(map(pred, r)) <= 91)
|
||||||
|
|
||||||
|
|
||||||
def testSafeArgument(self):
|
def testSafeArgument(self):
|
||||||
s = 'I have been running for 9 seconds'
|
s = 'I have been running for 9 seconds'
|
||||||
bolds = ircutils.bold(s)
|
bolds = ircutils.bold(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user