Permalink
Browse files

better display of tweets size, issue #29

  • Loading branch information...
1 parent d35c2b9 commit 82fc6fc19e7982a34ad2b3851335f1bb568de15c @Nic0 Nic0 committed May 28, 2011
Showing with 10 additions and 2 deletions.
  1. +10 −2 tyrs/uiTyrs.py
View
@@ -329,10 +329,18 @@ def displayText (self, text, panel, status):
while panel.inch(line, curent_x -1) == ord(' ') and panel.inch(line, curent_x -2) == ord(' '):
curent_x -= 1
-
def getSizeStatus (self, status):
length = self.maxyx[1] - 4
- height = len(status.text) / length + 3
+ x = 2
+ y = 1
+ words = status.text.split(' ')
+ for w in words:
+ if x+len(w) > length - 2:
+ y += 1
+ x = 2
+ x += len(w)+1
+
+ height = y + 2
size = {'length': length, 'height': height}
return size

0 comments on commit 82fc6fc

Please sign in to comment.