9
9
function ! lsp#utils#diff#compute (old, new ) abort
10
10
let [l: start_line , l: start_char ] = s: FirstDifference (a: old , a: new )
11
11
let [l: end_line , l: end_char ] =
12
- \ s: LastDifference (a: old [l: start_line :], a: new [l: start_line :], l: start_char )
12
+ \ s: LastDifference (a: old [l: start_line :], a: new [l: start_line :], l: start_char )
13
13
14
14
let l: text = s: ExtractText (a: new , l: start_line , l: start_char , l: end_line , l: end_char )
15
15
let l: length = s: Length (a: old , l: start_line , l: start_char , l: end_line , l: end_char )
@@ -43,7 +43,7 @@ function! s:FirstDifference(old, new) abort
43
43
let l: length = min ([strlen (l: old_line ), strlen (l: new_line )])
44
44
let l: j = 0
45
45
while l: j < l: length
46
- if l: old_line [l: j: l: j ] !=# l: new_line [l: j: l: j ] | break | endif
46
+ if l: old_line [l: j : l: j ] !=# l: new_line [l: j : l: j ] | break | endif
47
47
let l: j += 1
48
48
endwhile
49
49
return [l: i , l: j ]
@@ -59,16 +59,16 @@ function! s:LastDifference(old, new, start_char) abort
59
59
endwhile
60
60
if l: i <= -1 * l: line_count
61
61
let l: i = -1 * l: line_count
62
- let l: old_line = a: old [l: i ][a: start_char :]
63
- let l: new_line = a: new [l: i ][a: start_char :]
62
+ let l: old_line = a: old [l: i ][a: start_char :]
63
+ let l: new_line = a: new [l: i ][a: start_char :]
64
64
else
65
65
let l: old_line = a: old [l: i ]
66
66
let l: new_line = a: new [l: i ]
67
67
endif
68
68
let l: length = min ([strlen (l: old_line ), strlen (l: new_line )])
69
69
let l: j = -1
70
70
while l: j >= -1 * l: length
71
- if l: old_line [l: j: l: j ] !=# l: new_line [l: j: l: j ] | break | endif
71
+ if l: old_line [l: j : l: j ] !=# l: new_line [l: j : l: j ] | break | endif
72
72
let l: j -= 1
73
73
endwhile
74
74
return [l: i , l: j ]
@@ -77,12 +77,12 @@ endfunction
77
77
function ! s: ExtractText (lines , start_line, start_char, end_line, end_char) abort
78
78
if a: start_line == len (a: lines ) + a: end_line
79
79
if a: end_line == 0 | return ' ' | endif
80
- let l: result = a: lines [a: start_line ][a: start_char: a: end_char ]
80
+ let l: result = a: lines [a: start_line ][a: start_char : a: end_char ]
81
81
" json_encode treats empty string computed this was as 'null'
82
82
if strlen (l: result ) == 0 | let l: result = ' ' | endif
83
83
return l: result
84
84
endif
85
- let l: result = a: lines [a: start_line ][a: start_char :]." \n "
85
+ let l: result = a: lines [a: start_line ][a: start_char :]." \n "
86
86
let l: adj_end_line = len (a: lines ) + a: end_line
87
87
for l: line in a: lines [a: start_line + 1 :a: end_line - 1 ]
88
88
let l: result .= l: line ." \n "
0 commit comments