diff options
Diffstat (limited to 'contrib/hldiff.py')
-rwxr-xr-x | contrib/hldiff.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/hldiff.py b/contrib/hldiff.py index 8171625..716dbce 100755 --- a/contrib/hldiff.py +++ b/contrib/hldiff.py @@ -3,10 +3,13 @@ from colorama import Fore, Style import sys import re -patch = sys.stdin.read().replace("\r\n", "\n") +ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') stat_re = re.compile(r'(\+*)(\-*)') lines_re = re.compile(r'@@ (-\d+,\d+ \+\d+,\d+) @@') +patch = sys.stdin.read().replace("\r\n", "\n") +patch = ansi_escape.sub('', patch) + hit_diff = False for line in patch.split("\n"): if line.startswith("diff "): |