Mercurial > hg-stable
changeset 10831:441f5d66da03
color: concatenate effects correctly and avoid printing empty effects
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Sun, 04 Apr 2010 22:53:50 -0500 |
parents | 824310023e4a |
children | 420bc8124904 |
files | hgext/color.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/color.py Mon Apr 05 01:31:16 2010 +0200 +++ b/hgext/color.py Sun Apr 04 22:53:50 2010 -0500 @@ -134,9 +134,12 @@ _buffers = None def style(msg, label): - effects = '' + effects = [] for l in label.split(): - effects += _styles.get(l, '') + s = _styles.get(l, '') + if s: + effects.append(s) + effects = ''.join(effects) if effects: return '\n'.join([render_effects(s, effects) for s in msg.split('\n')])