# HG changeset patch # User Kevin Christen # Date 2008-07-15 23:10:37 # Node ID c6890cfc22531e6e504d89372bea503175c8ba7b # Parent 09db2b8236ecdac15181461b3c276a7ca3fe0957 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 --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -79,11 +79,12 @@ from mercurial.i18n import _ 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