Skip to content

Commit

Permalink
[merge addon] Lazily initialize diff_match_patch
Browse files Browse the repository at this point in the history
  • Loading branch information
scipper authored and marijnh committed Aug 24, 2017
1 parent f611d27 commit 91817cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addon/merge/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,10 @@
}

// Operations on diffs

var dmp = new diff_match_patch();
var dmp;
function getDiff(a, b, ignoreWhitespace) {
if (!dmp) dmp = new diff_match_patch();

var diff = dmp.diff_main(a, b);
// The library sometimes leaves in empty parts, which confuse the algorithm
for (var i = 0; i < diff.length; ++i) {
Expand Down

0 comments on commit 91817cc

Please sign in to comment.