equal
deleted
inserted
replaced
22 ) |
22 ) |
23 from . import ( |
23 from . import ( |
24 encoding, |
24 encoding, |
25 error, |
25 error, |
26 patch as patchmod, |
26 patch as patchmod, |
|
27 pycompat, |
27 scmutil, |
28 scmutil, |
28 util, |
29 util, |
29 ) |
30 ) |
30 from .utils import stringutil |
31 from .utils import stringutil |
31 |
32 |
1111 # preprocess the text, converting tabs to spaces |
1112 # preprocess the text, converting tabs to spaces |
1112 text = text.expandtabs(4) |
1113 text = text.expandtabs(4) |
1113 # strip \n, and convert control characters to ^[char] representation |
1114 # strip \n, and convert control characters to ^[char] representation |
1114 text = re.sub( |
1115 text = re.sub( |
1115 br'[\x00-\x08\x0a-\x1f]', |
1116 br'[\x00-\x08\x0a-\x1f]', |
1116 lambda m: b'^' + chr(ord(m.group()) + 64), |
1117 lambda m: b'^' + pycompat.sysbytes(chr(ord(m.group()) + 64)), |
1117 text.strip(b'\n'), |
1118 text.strip(b'\n'), |
1118 ) |
1119 ) |
1119 |
1120 |
1120 if pair is not None: |
1121 if pair is not None: |
1121 colorpair = pair |
1122 colorpair = pair |