Using escape for colored raw_input to avoid wrong calculation on readline
authorOrakaro <nhatminh_179@hotmail.com>
Thu, 21 Nov 2019 09:37:15 +0000 (18:37 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Thu, 21 Nov 2019 09:37:15 +0000 (18:37 +0900)
Still don't know why colors is ignored in Python 3.7.4

rainbowstream/rainbow.py

index 02bd2a9..c42437b 100644 (file)
@@ -1493,7 +1493,7 @@ def theme():
             # Redefine decorated_name
             g['decorated_name'] = lambda x: color_func(
                 c['DECORATED_NAME'])(
-                '[' + x + ']: ')
+                '[' + x + ']: ', rl=True)
             printNicely(green('Theme changed.'))
         except:
             printNicely(red('No such theme exists.'))
@@ -1556,7 +1556,7 @@ def config():
             if key == 'THEME':
                 c['THEME'] = reload_theme(value, c['THEME'])
                 g['decorated_name'] = lambda x: color_func(
-                    c['DECORATED_NAME'])('[' + x + ']: ')
+                    c['DECORATED_NAME'])('[' + x + ']: ', rl=True)
             elif key == 'PREFIX':
                 g['PREFIX'] = u2str(emojize(format_prefix(
                     listname=g['listname'],