mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 20:13:46 -05:00
extract updating hunk summary into another function.
This commit is contained in:
@@ -377,14 +377,18 @@ function! s:find_other_signs(file_name)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_signs(file_name, modified_lines)
|
function! s:show_signs(file_name, modified_lines)
|
||||||
let added = 0
|
|
||||||
let modified = 0
|
|
||||||
let removed = 0
|
|
||||||
for line in a:modified_lines
|
for line in a:modified_lines
|
||||||
let line_number = line[0]
|
let line_number = line[0]
|
||||||
let type = 'GitGutterLine' . s:snake_case_to_camel_case(line[1])
|
let type = 'GitGutterLine' . s:snake_case_to_camel_case(line[1])
|
||||||
call s:add_sign(line_number, type, a:file_name)
|
call s:add_sign(line_number, type, a:file_name)
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:update_hunk_summary(modified_lines)
|
||||||
|
let added = 0
|
||||||
|
let modified = 0
|
||||||
|
let removed = 0
|
||||||
|
for line in a:modified_lines
|
||||||
if match(line[1], 'added') > -1
|
if match(line[1], 'added') > -1
|
||||||
let added += 1
|
let added += 1
|
||||||
endif
|
endif
|
||||||
@@ -472,6 +476,7 @@ function! GitGutter(file, ...)
|
|||||||
call s:clear_signs(a:file)
|
call s:clear_signs(a:file)
|
||||||
call s:find_other_signs(a:file)
|
call s:find_other_signs(a:file)
|
||||||
call s:show_signs(a:file, modified_lines)
|
call s:show_signs(a:file, modified_lines)
|
||||||
|
call s:update_hunk_summary(modified_lines)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
command GitGutter call GitGutter(s:current_file())
|
command GitGutter call GitGutter(s:current_file())
|
||||||
|
|||||||
Reference in New Issue
Block a user