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 552cbbe1a84e47ac9248972855fef25e6df6ad60..7c66007ae7c37ec44a43519c739963c105914770 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 bdbc4b44c14d6af7c4009af898b13ed3e86bd44f..d3e55349e390787e218b307b01be471a74325453 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 62be3ec2ef5a9f9ce15eb9882f96fcb6520dfb90..45b7853bc6829f782e3a057ef480bf3c68083fec 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 03a3f1315f33b0f22a67d840638a4dda4550fe25..c4979378e76bed6ac86d0ac9ad9e45d246bad54a 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 4066ff16b0673010c794adbb2d7cf822600f2f72..2e126f68dcd26ab0c65ffd6bca6ceadfa79651d1 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 = [