mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Fix off-by-one error in LCS calculation
This commit is contained in:
@@ -135,11 +135,11 @@ function! s:lcs(s1, s2)
|
||||
|
||||
for i in range(1, len(a:s1))
|
||||
for j in range(1, len(a:s2))
|
||||
if a:s1[i] ==# a:s2[j]
|
||||
if a:s1[i-1] ==# a:s2[j-1]
|
||||
let matrix[i][j] = 1 + matrix[i-1][j-1]
|
||||
if matrix[i][j] > maxlength
|
||||
let maxlength = matrix[i][j]
|
||||
let endindex = i
|
||||
let endindex = i - 1
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
Reference in New Issue
Block a user