##// END OF EJS Templates
color: move 'write-err' logic to the core ui class...
Pierre-Yves David -
r31094:0c003943 default
parent child Browse files
Show More
@@ -297,19 +297,7 b' def _modesetup(ui, coloropt):'
297 297 return None
298 298
299 299 class colorui(uimod.ui):
300
301 def write_err(self, *args, **opts):
302 if self._colormode is None:
303 return super(colorui, self).write_err(*args, **opts)
304
305 label = opts.get('label', '')
306 if self._bufferstates and self._bufferstates[-1][0]:
307 return self.write(*args, **opts)
308 if self._colormode == 'win32':
309 color.win32print(super(colorui, self).write_err, *args, **opts)
310 else:
311 return super(colorui, self).write_err(
312 *[self.label(a, label) for a in args], **opts)
300 pass
313 301
314 302 def uisetup(ui):
315 303 if ui.plain():
@@ -823,8 +823,17 b' class ui(object):'
823 823 def write_err(self, *args, **opts):
824 824 self._progclear()
825 825 if self._bufferstates and self._bufferstates[-1][0]:
826 return self.write(*args, **opts)
827 self._write_err(*args, **opts)
826 self.write(*args, **opts)
827 elif self._colormode == 'win32':
828 # windows color printing is its own can of crab, defer to
829 # the color module and that is it.
830 color.win32print(self._write_err, *args, **opts)
831 else:
832 msgs = args
833 if self._colormode is not None:
834 label = opts.get('label', '')
835 msgs = [self.label(a, label) for a in args]
836 self._write_err(*msgs, **opts)
828 837
829 838 def _write_err(self, *msgs, **opts):
830 839 try:
General Comments 0
You need to be logged in to leave comments. Login now