Skip to content

Commit

Permalink
Color the text block splited by space only before newline
Browse files Browse the repository at this point in the history
  • Loading branch information
amane-katagiri committed May 18, 2017
1 parent 24a80d7 commit a8884f4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rainbowstream/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
if favorited:
fav = color_func(c['TWEET']['favorited'])(u'\u2605')

tweet = text.split(' ')
tweet = [x for x in tweet if x != '']
tweet = list()
for s in [x.replace('\n', '\n\0').split('\0') for x in text.split(' ')]:
tweet.extend(filter(lambda x: x != '', s))
# Replace url
if expanded_url:
for index in xrange(len(expanded_url)):
Expand Down Expand Up @@ -315,7 +316,7 @@ def draw(t, keyword=None, humanize=True, noti=False, fil=[], ig=[]):
]
# Highlight keyword
tweet = ' '.join(tweet)
tweet = '\n '.join(tweet.split('\n'))
tweet = tweet.replace('\n', '\n ')
if keyword:
roj = re.search(keyword, tweet, re.IGNORECASE)
if roj:
Expand Down

0 comments on commit a8884f4

Please sign in to comment.