mercurial/crecord.py
changeset 36305 a8bca9d0cea0
parent 35528 fb2e59e92651
child 36306 3496bffe266d
equal deleted inserted replaced
36304:6d6bc544467a 36305:a8bca9d0cea0
   948         if showwhtspc == True, trailing whitespace of a string is highlighted.
   948         if showwhtspc == True, trailing whitespace of a string is highlighted.
   949         """
   949         """
   950         # preprocess the text, converting tabs to spaces
   950         # preprocess the text, converting tabs to spaces
   951         text = text.expandtabs(4)
   951         text = text.expandtabs(4)
   952         # strip \n, and convert control characters to ^[char] representation
   952         # strip \n, and convert control characters to ^[char] representation
   953         text = re.sub(r'[\x00-\x08\x0a-\x1f]',
   953         text = re.sub(br'[\x00-\x08\x0a-\x1f]',
   954                 lambda m:'^' + chr(ord(m.group()) + 64), text.strip('\n'))
   954                 lambda m:'^' + chr(ord(m.group()) + 64), text.strip('\n'))
   955 
   955 
   956         if pair is not None:
   956         if pair is not None:
   957             colorpair = pair
   957             colorpair = pair
   958         elif pairname is not None:
   958         elif pairname is not None: