Comments
Patch
@@ -1587,6 +1587,11 @@ def _chunkdiff(store):
'''For each string in list1, finds matching string in list2 and returns
an iterator over their differences.
'''
+ buff = _inlinediff(''.join(list1), ''.join(list2), direction=direction)
+ for line in buff:
+ yield (line[1], line[0])
+ return
+
used = []
for a in list1:
done = False
@@ -1626,14 +1631,14 @@ def _inlinediff(from_string, to_string,
to_string = to_string[1:]
from_string = from_string[1:]
- s = difflib.ndiff(to_string.split(' '), from_string.split(' '))
+ s = difflib.ndiff(re.split(r'(\W)', to_string), re.split(r'(\W)', from_string))
for line in s:
if line[0] in direction_skip:
continue
l = 'diff.' + direction + '.highlight'
if line[0] in ' ': # unchanged parts
l = 'diff.' + direction
- buff.append((l, line[2:] + ' '))
+ buff.append((l, line[2:]))
buff[-1] = (buff[-1][0], buff[-1][1].strip(' '))
return buff