[PATCH 2 of 2] Add a reset before and after colorized output
Kevin Christen
kevin.christen at gmail.com
Tue Jul 15 18:18:40 CDT 2008
# HG changeset patch
# User Kevin Christen <kevin.christen at gmail.com>
# Date 1216163437 18000
# Node ID e5e807444bf995629692af10856bbda3a6b650c2
# Parent dbea8bbc3bfde00fb1061dc9b22f7ba4148043ed
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.
diff -r dbea8bbc3bfd -r e5e807444bf9 hgext/color.py
--- a/hgext/color.py Tue Jul 15 18:05:34 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
More information about the Mercurial-devel
mailing list