Mercurial > hg
comparison hgext/color.py @ 31087:894bdcdc75df
color: move the 'colorlabel' call to the core 'ui' class
This bring us closer to supporting color in core natively. Core already have a
'label' method that was a no-op. We update its to call the new 'colorlabel'
function. Behavior is unchanged when colormode = None.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 23 Feb 2017 19:45:32 +0100 |
parents | e6082078c853 |
children | a2ee25ff75e5 |
comparison
equal
deleted
inserted
replaced
31086:e6082078c853 | 31087:894bdcdc75df |
---|---|
325 for a in args: | 325 for a in args: |
326 color.win32print(a, super(colorui, self).write_err, **opts) | 326 color.win32print(a, super(colorui, self).write_err, **opts) |
327 else: | 327 else: |
328 return super(colorui, self).write_err( | 328 return super(colorui, self).write_err( |
329 *[self.label(a, label) for a in args], **opts) | 329 *[self.label(a, label) for a in args], **opts) |
330 | |
331 def label(self, msg, label): | |
332 if self._colormode is None: | |
333 return super(colorui, self).label(msg, label) | |
334 return color.colorlabel(self, msg, label) | |
335 | 330 |
336 def uisetup(ui): | 331 def uisetup(ui): |
337 if ui.plain(): | 332 if ui.plain(): |
338 return | 333 return |
339 if not isinstance(ui, colorui): | 334 if not isinstance(ui, colorui): |