color: concatenate effects correctly and avoid printing empty effects
authorBrodie Rao <brodie@bitheap.org>
Sun, 04 Apr 2010 22:53:50 -0500
changeset 10831 441f5d66da03
parent 10830 824310023e4a
child 10832 420bc8124904
color: concatenate effects correctly and avoid printing empty effects
hgext/color.py
--- 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')])