Skip to content

Commit 91817cc

Browse files
scippermarijnh
authored andcommitted
[merge addon] Lazily initialize diff_match_patch
1 parent f611d27 commit 91817cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

addon/merge/merge.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,10 @@
644644
}
645645

646646
// Operations on diffs
647-
648-
var dmp = new diff_match_patch();
647+
var dmp;
649648
function getDiff(a, b, ignoreWhitespace) {
649+
if (!dmp) dmp = new diff_match_patch();
650+
650651
var diff = dmp.diff_main(a, b);
651652
// The library sometimes leaves in empty parts, which confuse the algorithm
652653
for (var i = 0; i < diff.length; ++i) {

0 commit comments

Comments
 (0)