1
0
mirror of synced 2025-12-17 20:47:59 +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) { _optimize: function(ctx) {
var start = 0, end = 0; var start = 0, end = 0;
while (start < ctx.length) { while (start < ctx.codes.length) {
while ((start < ctx.length) && (ctx.modified[start] == undefined || ctx.modified[start] == false)) { while ((start < ctx.codes.length) && (ctx.modified[start] == undefined || ctx.modified[start] == false)) {
start++; start++;
} }
end = start; end = start;
while ((end < ctx.length) && (ctx.modified[end] == true)) { while ((end < ctx.codes.length) && (ctx.modified[end] == true)) {
end++; end++;
} }
if ((end < ctx.length) && (ctx.ctx[start] == ctx.codes[end])) { if ((end < ctx.codes.length) && (ctx.codes[start] == ctx.codes[end])) {
ctx.modified[start] = false; ctx.codes.modified[start] = false;
ctx.modified[end] = true; ctx.codes.modified[end] = true;
} }
else { else {
start = end; start = end;