From 3e86feb54c94e46b60168fd2a4773183eb1354b4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 21 Jan 2012 19:40:30 -0500 Subject: [PATCH] Speed up colorless diff --- test/shaping/hb_test_tools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/shaping/hb_test_tools.py b/test/shaping/hb_test_tools.py index 94c37b239..7ff7a0255 100644 --- a/test/shaping/hb_test_tools.py +++ b/test/shaping/hb_test_tools.py @@ -37,6 +37,12 @@ class FancyDiffer: @staticmethod def diff_lines (l1, l2, colors=Colors.Null): + # Easy without colors + if colors == Colors.Null: + if l1 == l2: + return [' ', l1] + return ['-', l1, '+', l2] + ss = [FancyDiffer.diff_regex.sub (r'\1\n\2\n', l).splitlines (True) for l in (l1, l2)] oo = ["",""] st = [False, False]