Line wrapping fix
This commit is contained in:
parent
14c8d3fe92
commit
bcf2ffdb8f
2 changed files with 3 additions and 2 deletions
|
|
@ -17,7 +17,8 @@ class QOTDHandler(BaseRequestHandler):
|
|||
s = ponysay.render_pony(pony, ponysay.random_quote(pony),
|
||||
balloonstyle=ponysay.balloonstyles['cowsay'],
|
||||
center=True,
|
||||
centertext=False)
|
||||
centertext=False,
|
||||
width=120)
|
||||
self.request.sendall(bytes(s, "UTF-8"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -73,5 +73,5 @@ def render_pony(name, text, balloonstyle, width=80, center=False, centertext=Fal
|
|||
ponywidth = max([ len(re.sub(r'\x1B\[[0-9;]+m|\$.*\$', '', line)) for line in pony ])
|
||||
indent = ' '*int((width-ponywidth)/2)
|
||||
wre = re.compile('((\x1B\[[0-9;]+m)*.){0,%s}' % width)
|
||||
return ''.join([ indent+wre.search(line).group()+'\n[49m' for line in pony ])
|
||||
return ''.join([ indent+wre.search(line).group()+'[49m\n' for line in pony ])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue