changeset 6856:c6890cfc2253

Add a reset before and after colorized output This is how GNU's ls --color works, and it clears up problems in xterm and Windows command prompt windows.
author Kevin Christen <kevin.christen@gmail.com>
date Tue, 15 Jul 2008 18:10:37 -0500
parents 09db2b8236ec
children e8c2dae47799 8f256bf98219
files hgext/color.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Wed Jul 23 20:33:23 2008 -0500
+++ b/hgext/color.py	Tue Jul 15 18:10:37 2008 -0500
@@ -79,11 +79,12 @@
 
 def render_effects(text, *effects):
     'Wrap text in commands to turn on each effect.'
-    start = []
+    start = [ str(_effect_params['none'][0]) ]
     stop = []
     for effect in effects:
         start.append(str(_effect_params[effect][0]))
         stop.append(str(_effect_params[effect][1]))
+    stop.append(str(_effect_params['none'][1]))
     start = '\033[' + ';'.join(start) + 'm'
     stop = '\033[' + ';'.join(stop) + 'm'
     return start + text + stop