Commit 0061ba1c authored by Kai Willadsen's avatar Kai Willadsen

Simplify composition of the change sequences

parent 8032a2fa
...@@ -149,17 +149,14 @@ class Differ(object): ...@@ -149,17 +149,14 @@ class Differ(object):
if textindex in (0,2): if textindex in (0,2):
seq = textindex/2 seq = textindex/2
for cs in self.all_changes( texts ): for cs in self.all_changes( texts ):
c = cs[seq] if cs[seq]:
if c: yield reverse_chunk(cs[seq]) + (1,)
yield opcode_reverse[c[0]], c[3], c[4], c[1], c[2], 1
else: else:
for cs in self.all_changes( texts ): for cs in self.all_changes( texts ):
if cs[0]: if cs[0]:
c = cs[0] yield cs[0] + (0,)
yield c[0], c[1], c[2], c[3], c[4], 0
elif cs[1]: elif cs[1]:
c = cs[1] yield cs[1] + (2,)
yield c[0], c[1], c[2], c[3], c[4], 2
def _merge_blocks(self, using): def _merge_blocks(self, using):
LO, HI = 1,2 LO, HI = 1,2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment