##// END OF EJS Templates
color: move the 'colorlabel' call to the core 'ui' class...
Pierre-Yves David -
r31087:894bdcdc default
parent child Browse files
Show More
@@ -328,11 +328,6 b' class colorui(uimod.ui):'
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
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
336 def uisetup(ui):
331 def uisetup(ui):
337 if ui.plain():
332 if ui.plain():
338 return
333 return
@@ -26,6 +26,7 b' from .i18n import _'
26 from .node import hex
26 from .node import hex
27
27
28 from . import (
28 from . import (
29 color,
29 config,
30 config,
30 encoding,
31 encoding,
31 error,
32 error,
@@ -1364,13 +1365,15 b' class ui(object):'
1364 def label(self, msg, label):
1365 def label(self, msg, label):
1365 '''style msg based on supplied label
1366 '''style msg based on supplied label
1366
1367
1367 Like ui.write(), this just returns msg unchanged, but extensions
1368 If some color mode is enabled, this will add the necessary control
1368 and GUI tools can override it to allow styling output without
1369 characters to apply such color. In addition, 'debug' color mode adds
1369 writing it.
1370 markup showing which label affects a piece of text.
1370
1371
1371 ui.write(s, 'label') is equivalent to
1372 ui.write(s, 'label') is equivalent to
1372 ui.write(ui.label(s, 'label')).
1373 ui.write(ui.label(s, 'label')).
1373 '''
1374 '''
1375 if self._colormode is not None:
1376 return color.colorlabel(self, msg, label)
1374 return msg
1377 return msg
1375
1378
1376 def develwarn(self, msg, stacklevel=1, config=None):
1379 def develwarn(self, msg, stacklevel=1, config=None):
General Comments 0
You need to be logged in to leave comments. Login now