##// END OF EJS Templates
crecord: honor "ui.color = no" config option...
Elmar Bartel -
r35545:f43dc62c default
parent child Browse files
Show More
@@ -581,6 +581,13 b' class curseschunkselector(object):'
581 # maps custom nicknames of color-pairs to curses color-pair values
581 # maps custom nicknames of color-pairs to curses color-pair values
582 self.colorpairnames = {}
582 self.colorpairnames = {}
583
583
584 # Honor color setting of ui section. Keep colored setup as
585 # long as not explicitly set to a falsy value - especially,
586 # when not set at all. This is to stay most compatible with
587 # previous (color only) behaviour.
588 uicolor = util.parsebool(self.ui.config('ui', 'color'))
589 self.usecolor = uicolor is not False
590
584 # the currently selected header, hunk, or hunk-line
591 # the currently selected header, hunk, or hunk-line
585 self.currentselecteditem = self.headerlist[0]
592 self.currentselecteditem = self.headerlist[0]
586
593
@@ -1371,11 +1378,19 b' class curseschunkselector(object):'
1371 colorpair = self.colorpairs[(fgcolor, bgcolor)]
1378 colorpair = self.colorpairs[(fgcolor, bgcolor)]
1372 else:
1379 else:
1373 pairindex = len(self.colorpairs) + 1
1380 pairindex = len(self.colorpairs) + 1
1374 curses.init_pair(pairindex, fgcolor, bgcolor)
1381 if self.usecolor:
1375 colorpair = self.colorpairs[(fgcolor, bgcolor)] = (
1382 curses.init_pair(pairindex, fgcolor, bgcolor)
1376 curses.color_pair(pairindex))
1383 colorpair = self.colorpairs[(fgcolor, bgcolor)] = (
1377 if name is not None:
1384 curses.color_pair(pairindex))
1378 self.colorpairnames[name] = curses.color_pair(pairindex)
1385 if name is not None:
1386 self.colorpairnames[name] = curses.color_pair(pairindex)
1387 else:
1388 cval = 0
1389 if name is not None:
1390 if name == 'selected':
1391 cval = curses.A_REVERSE
1392 self.colorpairnames[name] = cval
1393 colorpair = self.colorpairs[(fgcolor, bgcolor)] = cval
1379
1394
1380 # add attributes if possible
1395 # add attributes if possible
1381 if attrlist is None:
1396 if attrlist is None:
General Comments 0
You need to be logged in to leave comments. Login now