Skip to content

Commit defd8f3

Browse files
committed
Release 2.10.0
1 parent 0e1a908 commit defd8f3

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

dist/diff2html.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3518,6 +3518,7 @@ process.umask = function() { return 0; };
35183518
matching: 'none',
35193519
matchWordsThreshold: 0.25,
35203520
matchingMaxComparisons: 2500,
3521+
maxLineSizeInBlockForComparison: 200,
35213522
maxLineLengthHighlight: 10000,
35223523
renderNothingWhenEmpty: false
35233524
};
@@ -3881,9 +3882,17 @@ process.umask = function() { return 0; };
38813882
var deleteType;
38823883

38833884
var comparisons = oldLines.length * newLines.length;
3884-
var maxComparisons = that.config.matchingMaxComparisons || 2500;
3885-
var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
3886-
that.config.matching === 'words');
3885+
3886+
var maxLineSizeInBlock = Math.max.apply(null,
3887+
[0].concat((oldLines.concat(newLines)).map(
3888+
function(elem) {
3889+
return elem.content.length;
3890+
}
3891+
)));
3892+
3893+
var doMatching = comparisons < that.config.matchingMaxComparisons &&
3894+
maxLineSizeInBlock < that.config.maxLineSizeInBlockForComparison &&
3895+
(that.config.matching === 'lines' || that.config.matching === 'words');
38873896

38883897
if (doMatching) {
38893898
matches = matcher(oldLines, newLines);
@@ -4505,9 +4514,14 @@ process.umask = function() { return 0; };
45054514
var deleteType;
45064515

45074516
var comparisons = oldLines.length * newLines.length;
4508-
var maxComparisons = that.config.matchingMaxComparisons || 2500;
4509-
var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
4510-
that.config.matching === 'words');
4517+
4518+
var maxLineSizeInBlock = Math.max.apply(null, (oldLines.concat(newLines)).map(function(elem) {
4519+
return elem.length;
4520+
}));
4521+
4522+
var doMatching = comparisons < that.config.matchingMaxComparisons &&
4523+
maxLineSizeInBlock < that.config.maxLineSizeInBlockForComparison &&
4524+
(that.config.matching === 'lines' || that.config.matching === 'words');
45114525

45124526
if (doMatching) {
45134527
matches = matcher(oldLines, newLines);

dist/diff2html.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/demo.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "diff2html",
3-
"version": "2.9.0",
3+
"version": "2.10.0",
44
"homepage": "https://diff2html.xyz",
55
"description": "Fast Diff to colorized HTML",
66
"keywords": [

0 commit comments

Comments
 (0)