From c285decf5ea339ea76608bab8e2c9d96f1395944 Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Fri, 29 Aug 2014 12:13:26 +0900 Subject: [PATCH] fix bug of unicode prefix character --- docs/conf.py | 4 ++-- rainbowstream/rainbow.py | 11 ++++++----- setup.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ade949a..e2755a4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '0.9.1' +version = '0.9.2' # The full version, including alpha/beta/rc tags. -release = '0.9.1' +release = '0.9.2' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index de908e6..c939747 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -122,6 +122,7 @@ def init(args): name = credential['name'] if not get_config('PREFIX'): set_config('PREFIX', screen_name) + g['PREFIX'] = u2str(c['PREFIX']) c['original_name'] = g['original_name'] = screen_name[1:] g['full_name'] = name g['decorated_name'] = lambda x: color_func( @@ -1700,7 +1701,7 @@ def listen(): try: # raw_input if g['prefix']: - line = raw_input(g['decorated_name'](c['PREFIX'])) + line = raw_input(g['decorated_name'](g['PREFIX'])) else: line = raw_input() # Save cmd to compare with readline buffer @@ -1727,7 +1728,7 @@ def listen(): printNicely('') except Exception: printNicely(red('OMG something is wrong with Twitter right now.')) - + break def stream(domain, args, name='Rainbow Stream'): """ @@ -1784,7 +1785,7 @@ def stream(domain, args, name='Rainbow Stream'): light_green("h stream") + \ light_magenta(" for more details.") printNicely(guide) - sys.stdout.write(g['decorated_name'](c['PREFIX'])) + sys.stdout.write(g['decorated_name'](g['PREFIX'])) sys.stdout.flush() StreamLock.release() break @@ -1812,10 +1813,10 @@ def stream(domain, args, name='Rainbow Stream'): # the 1st character of that word if current_buffer and g['cmd'] != current_buffer: sys.stdout.write( - g['decorated_name'](c['PREFIX']) + str2u(current_buffer)) + g['decorated_name'](g['PREFIX']) + str2u(current_buffer)) sys.stdout.flush() elif not c['HIDE_PROMPT']: - sys.stdout.write(g['decorated_name'](c['PREFIX'])) + sys.stdout.write(g['decorated_name'](g['PREFIX'])) sys.stdout.flush() elif tweet.get('direct_message'): # Check the semaphore pause and lock (stream process only) diff --git a/setup.py b/setup.py index 6337cfe..34088f6 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '0.9.1' +version = '0.9.2' # Require install_requires = [ -- 2.25.1