aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-20 00:28:01 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-20 00:28:01 +0200
commitb36f6d55272ded1f742e361e7b81599c48bf44fe (patch)
tree28c9704512ffc8d194b3f1e7079ccd0c574c29ee
parent7f1e5535b32324cdbe4b9d1d997f6c237a172807 (diff)
downloadponysay-b36f6d55272ded1f742e361e7b81599c48bf44fe.tar.gz
ponysay-b36f6d55272ded1f742e361e7b81599c48bf44fe.tar.bz2
ponysay-b36f6d55272ded1f742e361e7b81599c48bf44fe.zip
work on balloon
-rwxr-xr-xponysay.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/ponysay.py b/ponysay.py
index b74e251..a687ecc 100755
--- a/ponysay.py
+++ b/ponysay.py
@@ -950,14 +950,20 @@ class Backend():
if self.wrapcolumn is not None:
wrap = self.wrapcolumn - left
- w = 6
- h = 5
+ lines = self.message.split('\n')
+ h = 4 + len(lines)
+ w = 6 + len(max(lines, key = len))
if w < width: w = width
if h < height: h = height
- rc = (('X' * w) + '\n') * h
+ rc = '/' + '-' * (w - 2) + '\\\n'
+ rc += '|' + ' ' * (w - 2) + '|\n'
+ for line in lines:
+ rc += '| ' + line + ' ' * (w - len(line) - 6) + ' |\n'
+ rc += '|' + ' ' * (w - 2) + '|\n'
+ rc += '\\' + '-' * (w - 2) + '/'
- return rc[:-1]
+ return rc