summaryrefslogtreecommitdiff
path: root/lib/diff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2020-06-23 11:33:25 -0400
committerAustin Ziegler <austin@zieglers.ca>2020-06-23 11:33:25 -0400
commita7a595e2d5d3b4658d21d33f3f62f7c85ee4c82b (patch)
tree8e32eb2596f67159dca5302a3efaafcf25bed4de /lib/diff
parent4168a8eb56231152697290d14ac62a02eac9ac3f (diff)
downloaddiff-lcs-a7a595e2d5d3b4658d21d33f3f62f7c85ee4c82b.tar.gz
Fix an issue with negative hunk max_size
Resolves #57. - The `diff_size` should be an absolute value. - Added a test to ensure that the issue does not introduce a regression.
Diffstat (limited to 'lib/diff')
-rw-r--r--lib/diff/lcs.rb2
-rw-r--r--lib/diff/lcs/block.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb
index c4d1cc8..b6d0a86 100644
--- a/lib/diff/lcs.rb
+++ b/lib/diff/lcs.rb
@@ -49,7 +49,7 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
# a x b y c z p d q
# a b c a x b y c z
module Diff::LCS
- VERSION = '1.4'
+ VERSION = '1.4.1'
end
require 'diff/lcs/callbacks'
diff --git a/lib/diff/lcs/block.rb b/lib/diff/lcs/block.rb
index 430702d..fe86793 100644
--- a/lib/diff/lcs/block.rb
+++ b/lib/diff/lcs/block.rb
@@ -19,7 +19,7 @@ class Diff::LCS::Block
end
def diff_size
- @insert.size - @remove.size
+ (@insert.size - @remove.size).abs
end
def op