vendor/assets/javascripts/codemirror/addons/merge/merge.js in codemirror-rails-4.11 vs vendor/assets/javascripts/codemirror/addons/merge/merge.js in codemirror-rails-4.12

- old
+ new

@@ -257,15 +257,17 @@ // Updating the gap between editor and original function makeConnections(dv) { if (!dv.showDifferences) return; - var align = dv.mv.options.connect == "align"; + var align = dv.mv.options.connect == "align", oldScrollEdit, oldScrollOrig; if (align) { if (!dv.orig.curOp) return dv.orig.operation(function() { makeConnections(dv); }); + oldScrollEdit = dv.edit.getScrollInfo().top; + oldScrollOrig = dv.orig.getScrollInfo().top; for (var i = 0; i < dv.aligners.length; i++) dv.aligners[i].clear(); dv.aligners.length = 0; var extraSpaceAbove = {edit: 0, orig: 0}; } @@ -291,9 +293,11 @@ if (align) { if (extraSpaceAbove.edit) dv.aligners.push(padBelow(dv.edit, 0, extraSpaceAbove.edit)); if (extraSpaceAbove.orig) dv.aligners.push(padBelow(dv.orig, 0, extraSpaceAbove.orig)); + dv.edit.scrollTo(null, oldScrollEdit); + dv.orig.scrollTo(null, oldScrollOrig); } } function drawConnectorsForChunk(dv, topOrig, botOrig, topEdit, botEdit, sTopOrig, sTopEdit, w) { var flip = dv.type == "left";