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

[merge addon] Add leftChunks and rightChunks methods

Issue #2334
parent 809fe262
No related branches found
No related tags found
No related merge requests found
......@@ -353,6 +353,12 @@
setShowDifferences: function(val) {
if (this.right) this.right.setShowDifferences(val);
if (this.left) this.left.setShowDifferences(val);
},
rightChunks: function() {
return this.right && getChunks(this.right.diff);
},
leftChunks: function() {
return this.left && getChunks(this.left.diff);
}
};
......@@ -403,6 +409,15 @@
f(startOrig, orig.line + 1, startEdit, edit.line + 1);
}
function getChunks(diff) {
var collect = [];
iterateChunks(diff, function(topOrig, botOrig, topEdit, botEdit) {
collect.push({origFrom: topOrig, origTo: botOrig,
editFrom: topEdit, editTo: botEdit});
});
return collect;
}
function endOfLineClean(diff, i) {
if (i == diff.length - 1) return true;
var next = diff[i + 1][1];
......
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