hgext/color.py
changeset 31094 0c003943134f
parent 31091 ad074f900907
child 31095 b4cb86ab4c71
equal deleted inserted replaced
31093:15d6488554b9 31094:0c003943134f
   295     if always or (auto and formatted):
   295     if always or (auto and formatted):
   296         return realmode
   296         return realmode
   297     return None
   297     return None
   298 
   298 
   299 class colorui(uimod.ui):
   299 class colorui(uimod.ui):
   300 
   300     pass
   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)
       
   313 
   301 
   314 def uisetup(ui):
   302 def uisetup(ui):
   315     if ui.plain():
   303     if ui.plain():
   316         return
   304         return
   317     if not isinstance(ui, colorui):
   305     if not isinstance(ui, colorui):