hldiff.py: don't highlight -/+ in filenames
This commit is contained in:
parent
92b10fcef5
commit
d1ea181135
|
@ -4,7 +4,7 @@ import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
|
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
|
||||||
stat_re = re.compile(r'(\+*)(\-*)')
|
stat_re = re.compile(r'(| \d+ )(\+*)(\-*)')
|
||||||
lines_re = re.compile(r'@@ (-\d+,\d+ \+\d+,\d+) @@')
|
lines_re = re.compile(r'@@ (-\d+,\d+ \+\d+,\d+) @@')
|
||||||
|
|
||||||
patch = sys.stdin.read().replace("\r\n", "\n")
|
patch = sys.stdin.read().replace("\r\n", "\n")
|
||||||
|
@ -33,6 +33,6 @@ for line in patch.split("\n"):
|
||||||
else:
|
else:
|
||||||
if line.startswith(" ") and "|" in line and ("+" in line or "-" in line):
|
if line.startswith(" ") and "|" in line and ("+" in line or "-" in line):
|
||||||
line = stat_re.sub(
|
line = stat_re.sub(
|
||||||
f'{Fore.GREEN}\\1{Fore.RED}\\2{Style.RESET_ALL}',
|
f'\\1{Fore.GREEN}\\2{Fore.RED}\\3{Style.RESET_ALL}',
|
||||||
line)
|
line)
|
||||||
print(line)
|
print(line)
|
||||||
|
|
Loading…
Reference in New Issue