##// END OF EJS Templates
color: turn colorui functions into forwards when color is None...
Siddharth Agarwal -
r19072:b7b50a54 stable
parent child Browse files
Show More
@@ -317,6 +317,9 b' def configstyles(ui):'
317
317
318 class colorui(uimod.ui):
318 class colorui(uimod.ui):
319 def popbuffer(self, labeled=False):
319 def popbuffer(self, labeled=False):
320 if self._colormode is None:
321 return super(colorui, self).popbuffer(labeled)
322
320 if labeled:
323 if labeled:
321 return ''.join(self.label(a, label) for a, label
324 return ''.join(self.label(a, label) for a, label
322 in self._buffers.pop())
325 in self._buffers.pop())
@@ -324,6 +327,9 b' class colorui(uimod.ui):'
324
327
325 _colormode = 'ansi'
328 _colormode = 'ansi'
326 def write(self, *args, **opts):
329 def write(self, *args, **opts):
330 if self._colormode is None:
331 return super(colorui, self).write(*args, **opts)
332
327 label = opts.get('label', '')
333 label = opts.get('label', '')
328 if self._buffers:
334 if self._buffers:
329 self._buffers[-1].extend([(str(a), label) for a in args])
335 self._buffers[-1].extend([(str(a), label) for a in args])
@@ -335,6 +341,9 b' class colorui(uimod.ui):'
335 *[self.label(str(a), label) for a in args], **opts)
341 *[self.label(str(a), label) for a in args], **opts)
336
342
337 def write_err(self, *args, **opts):
343 def write_err(self, *args, **opts):
344 if self._colormode is None:
345 return super(colorui, self).write_err(*args, **opts)
346
338 label = opts.get('label', '')
347 label = opts.get('label', '')
339 if self._colormode == 'win32':
348 if self._colormode == 'win32':
340 for a in args:
349 for a in args:
@@ -344,6 +353,9 b' class colorui(uimod.ui):'
344 *[self.label(str(a), label) for a in args], **opts)
353 *[self.label(str(a), label) for a in args], **opts)
345
354
346 def label(self, msg, label):
355 def label(self, msg, label):
356 if self._colormode is None:
357 return super(colorui, self).label(msg, label)
358
347 effects = []
359 effects = []
348 for l in label.split():
360 for l in label.split():
349 s = _styles.get(l, '')
361 s = _styles.get(l, '')
General Comments 0
You need to be logged in to leave comments. Login now