fix readline calculation bug with escape sequence in colored mode
authorOrakaro <nhatminh_179@hotmail.com>
Sun, 24 Aug 2014 06:01:04 +0000 (15:01 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Sun, 24 Aug 2014 06:01:04 +0000 (15:01 +0900)
docs/conf.py
rainbowstream/colors.py
rainbowstream/interactive.py
rainbowstream/rainbow.py
setup.py

index 552cbbe..7c66007 100644 (file)
@@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh'
 # built documents.
 #
 # The short X.Y version.
-version = '0.8.3'
+version = '0.8.4'
 # The full version, including alpha/beta/rc tags.
-release = '0.8.3'
+release = '0.8.4'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index bdbc4b4..d3e5534 100644 (file)
@@ -6,7 +6,7 @@ def basic_color(code):
         c = code
         if bold:
             c = "1;%s" % c
-        return "\033[%sm%s\033[0m" % (c, text)
+        return "\001\033[%sm\002%s\001\033[0m\002" % (c, text)
     return inner
 
 
@@ -16,7 +16,7 @@ def term_color(code):
     """
     def inner(text):
         c = code
-        return "\033[38;5;%sm%s\033[0m" % (c, text)
+        return "\001\033[38;5;%sm\002%s\001\033[0m\002" % (c, text)
     return inner
 
 
index 62be3ec..45b7853 100644 (file)
@@ -84,9 +84,6 @@ def init_interactive_shell(d):
     Init the rainbow shell
     """
     readline.set_completer(RainbowCompleter(d).complete)
-    readline.parse_and_bind('set editing-mode vi')
-    readline.parse_and_bind('set show-all-if-ambiguous on')
-    readline.parse_and_bind('set show-all-if-unmodified on')
     readline.parse_and_bind('set skip-completed-text on')
     if 'libedit' in readline.__doc__:
         readline.parse_and_bind("bind ^I rl_complete")
index 03a3f13..c497937 100644 (file)
@@ -1666,19 +1666,19 @@ def listen():
     read_history()
     reset()
     while True:
-        # raw_input
-        if g['prefix']:
-            line = raw_input(g['decorated_name'](c['PREFIX']))
-        else:
-            line = raw_input()
-        # Save cmd to compare with readline buffer
-        g['cmd'] = line.strip()
-        # Get short cmd to pass to handle function
-        try:
-            cmd = line.split()[0]
-        except:
-            cmd = ''
         try:
+            # raw_input
+            if g['prefix']:
+                line = raw_input(g['decorated_name'](c['PREFIX']))
+            else:
+                line = raw_input()
+            # Save cmd to compare with readline buffer
+            g['cmd'] = line.strip()
+            # Get short cmd to pass to handle function
+            try:
+                cmd = line.split()[0]
+            except:
+                cmd = ''
             # Lock the semaphore
             c['lock'] = True
             # Save cmd to global variable and call process
@@ -1692,6 +1692,8 @@ def listen():
                 g['prefix'] = True
             # Release the semaphore lock
             c['lock'] = False
+        except EOFError:
+            printNicely('')
         except Exception:
             printNicely(red('OMG something is wrong with Twitter right now.'))
 
index 4066ff1..2e126f6 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ import os
 import os.path
 
 # Bumped version
-version = '0.8.3'
+version = '0.8.4'
 
 # Require
 install_requires = [