diff options
author | tiendo1011 <tiendo1011@gmail.com> | 2021-12-19 16:44:38 +0700 |
---|---|---|
committer | tiendo1011 <tiendo1011@gmail.com> | 2021-12-19 16:49:28 +0700 |
commit | eb5b8cb8b5622915aa43fb1d50f9feba7bf2f5f4 (patch) | |
tree | b14bfa787056072b3568cdad0e562c3c7c0b70d8 /lib | |
parent | cd4b76d53d77fa596d72584d7531fdb811cd38bf (diff) | |
download | diff-lcs-eb5b8cb8b5622915aa43fb1d50f9feba7bf2f5f4.tar.gz |
Fix off-by-one error
in ruby, (0..matches.size) will include both sides in the range, which
means we'll get off-by-one error
Diffstat (limited to 'lib')
-rw-r--r-- | lib/diff/lcs.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb index 63888a1..f57ec08 100644 --- a/lib/diff/lcs.rb +++ b/lib/diff/lcs.rb @@ -292,7 +292,7 @@ class << Diff::LCS b_size = seq2.size ai = bj = 0 - (0..matches.size).each do |i| + (0...matches.size).each do |i| b_line = matches[i] ax = string ? seq1[i, 1] : seq1[i] |