1
0
mirror of synced 2025-12-15 19:14:08 +08:00

Fixed optimize

This commit is contained in:
Jamie Peabody
2016-05-24 22:45:26 +01:00
parent c4776b1359
commit bec45a41a3

View File

@@ -297,17 +297,17 @@ jQuery.extend(Mgly.diff.prototype, {
},
_optimize: function(ctx) {
var start = 0, end = 0;
while (start < ctx.length) {
while ((start < ctx.length) && (ctx.modified[start] == undefined || ctx.modified[start] == false)) {
while (start < ctx.codes.length) {
while ((start < ctx.codes.length) && (ctx.modified[start] == undefined || ctx.modified[start] == false)) {
start++;
}
end = start;
while ((end < ctx.length) && (ctx.modified[end] == true)) {
while ((end < ctx.codes.length) && (ctx.modified[end] == true)) {
end++;
}
if ((end < ctx.length) && (ctx.ctx[start] == ctx.codes[end])) {
ctx.modified[start] = false;
ctx.modified[end] = true;
if ((end < ctx.codes.length) && (ctx.codes[start] == ctx.codes[end])) {
ctx.codes.modified[start] = false;
ctx.codes.modified[end] = true;
}
else {
start = end;