Show More
@@ -331,16 +331,17 class colorui(uimod.ui): | |||||
331 | def label(self, msg, label): |
|
331 | def label(self, msg, label): | |
332 | if self._colormode is None: |
|
332 | if self._colormode is None: | |
333 | return super(colorui, self).label(msg, label) |
|
333 | return super(colorui, self).label(msg, label) | |
|
334 | return colorlabel(self, msg, label) | |||
334 |
|
335 | |||
335 | if self._colormode == 'debug': |
|
336 | def colorlabel(ui, msg, label): | |
336 | if label and msg: |
|
337 | """add color control code according to the mode""" | |
337 | if msg[-1] == '\n': |
|
338 | if ui._colormode == 'debug': | |
338 | return "[%s|%s]\n" % (label, msg[:-1]) |
|
339 | if label and msg: | |
339 |
|
|
340 | if msg[-1] == '\n': | |
340 |
|
|
341 | msg = "[%s|%s]\n" % (label, msg[:-1]) | |
341 | else: |
|
342 | else: | |
342 | return msg |
|
343 | msg = "[%s|%s]" % (label, msg) | |
343 |
|
344 | elif ui._colormode is not None: | ||
344 | effects = [] |
|
345 | effects = [] | |
345 | for l in label.split(): |
|
346 | for l in label.split(): | |
346 | s = color._styles.get(l, '') |
|
347 | s = color._styles.get(l, '') | |
@@ -350,9 +351,9 class colorui(uimod.ui): | |||||
350 | effects.append(l) |
|
351 | effects.append(l) | |
351 | effects = ' '.join(effects) |
|
352 | effects = ' '.join(effects) | |
352 | if effects: |
|
353 | if effects: | |
353 |
|
|
354 | msg = '\n'.join([color._render_effects(line, effects) | |
354 |
|
|
355 | for line in msg.split('\n')]) | |
355 |
|
|
356 | return msg | |
356 |
|
357 | |||
357 | def uisetup(ui): |
|
358 | def uisetup(ui): | |
358 | if ui.plain(): |
|
359 | if ui.plain(): |
General Comments 0
You need to be logged in to leave comments.
Login now