Skip to content
Snippets Groups Projects
Commit ea796dad authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[merge addon] Fix sorted insertion in aligned line set (again)

Issue #4353
parent 6d3a7457
No related branches found
No related tags found
No related merge requests found
......@@ -335,20 +335,14 @@
linesToAlign.push([chunk.origTo, chunk.editTo, other ? getMatchingOrigLine(chunk.editTo, other.chunks) : null]);
}
if (other) {
for (var i = 0; i < other.chunks.length; i++) {
chunkLoop: for (var i = 0; i < other.chunks.length; i++) {
var chunk = other.chunks[i];
for (var j = 0; j < linesToAlign.length; j++) {
var align = linesToAlign[j];
if (align[1] == chunk.editTo) {
j = -2;
break;
} else if (align[1] > chunk.editTo) {
j--
break;
}
var diff = linesToAlign[j][1] - chunk.editTo;
if (diff == 0) continue chunkLoop
if (diff > 0) break;
}
if (j > -2)
linesToAlign.splice(j, 0, [getMatchingOrigLine(chunk.editTo, dv.chunks), chunk.editTo, chunk.origTo]);
linesToAlign.splice(j, 0, [getMatchingOrigLine(chunk.editTo, dv.chunks), chunk.editTo, chunk.origTo]);
}
}
return linesToAlign;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment