Mercurial > public > mercurial-scm > hg-stable
diff mercurial/color.py @ 31132:f5131d4f512a
color: move 'styles' definition on the 'ui' object
Same logic as for '_terminfoparams'. The content depends on the config so it
should be specific to each 'ui instance.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sun, 06 Nov 2016 20:16:01 +0100 |
parents | 1613c55ad3d6 |
children | 6483e49204ee |
line wrap: on
line diff
--- a/mercurial/color.py Sun Nov 06 20:10:53 2016 +0100 +++ b/mercurial/color.py Sun Nov 06 20:16:01 2016 +0100 @@ -254,6 +254,7 @@ return None def configstyles(ui): + ui._styles.update(_styles) for status, cfgeffects in ui.configitems('color'): if '.' not in status or status.startswith(('color.', 'terminfo.')): continue @@ -267,7 +268,7 @@ ui.warn(_("ignoring unknown color/effect %r " "(configured in color.%s)\n") % (e, status)) - _styles[status] = ' '.join(good) + ui._styles[status] = ' '.join(good) def valideffect(ui, effect): 'Determine if the effect is valid or not.' @@ -321,7 +322,7 @@ elif ui._colormode is not None: effects = [] for l in label.split(): - s = _styles.get(l, '') + s = ui._styles.get(l, '') if s: effects.append(s) elif valideffect(ui, l): @@ -443,7 +444,7 @@ # determine console attributes based on labels for l in label.split(): - style = _styles.get(l, '') + style = ui._styles.get(l, '') for effect in style.split(): try: attr = mapcolor(w32effects[effect], attr)