appy.shared.diff: bugfixes.
This commit is contained in:
parent
38260cc2a5
commit
17f6d15185
|
@ -68,6 +68,11 @@ class HtmlDiff:
|
||||||
jn = len(new)
|
jn = len(new)
|
||||||
diffFound = False
|
diffFound = False
|
||||||
while not diffFound:
|
while not diffFound:
|
||||||
|
if (jo == i) or (jn == i):
|
||||||
|
# We have reached the end of substring old[i:] or new[i:]
|
||||||
|
jo -=1
|
||||||
|
jn -= 1
|
||||||
|
break
|
||||||
jo -= 1
|
jo -= 1
|
||||||
jn -= 1
|
jn -= 1
|
||||||
if old[jo] != new[jn]: diffFound=True
|
if old[jo] != new[jn]: diffFound=True
|
||||||
|
@ -167,6 +172,10 @@ class HtmlDiff:
|
||||||
i, ja, jb = self.getStringDiff(lineA, lineB)
|
i, ja, jb = self.getStringDiff(lineA, lineB)
|
||||||
diff = self.getHtmlDiff(lineA[i:ja],lineB[i:jb],' ')
|
diff = self.getHtmlDiff(lineA[i:ja],lineB[i:jb],' ')
|
||||||
toAdd += lineB[:i] + diff + lineB[jb:]
|
toAdd += lineB[:i] + diff + lineB[jb:]
|
||||||
|
else:
|
||||||
|
if ((i2-i1) == 1) and (a[i1] == ''):
|
||||||
|
# difflib has considered an empty char as 'removed' (?)
|
||||||
|
toAdd = ''
|
||||||
else:
|
else:
|
||||||
toAdd = self.getModifiedChunk(a[i1:i2],'delete', sep)
|
toAdd = self.getModifiedChunk(a[i1:i2],'delete', sep)
|
||||||
toAdd += self.getModifiedChunk(b[j1:j2],'insert', sep)
|
toAdd += self.getModifiedChunk(b[j1:j2],'insert', sep)
|
||||||
|
|
Loading…
Reference in a new issue