Fix sign overwrite issue

References #64.
This commit is contained in:
Marco Hinz 2013-09-06 15:34:13 +02:00
parent 52e7f7902d
commit 4167fa0373

View File

@ -23,32 +23,37 @@ endfunction
" Function: #set {{{1 " Function: #set {{{1
function! sy#sign#set(signs) function! sy#sign#set(signs)
let hunk = { 'ids': [], 'start': a:signs[0].lnum, 'end': a:signs[-1].lnum } let hunk = { 'ids': [], 'start': a:signs[0].lnum, 'end': a:signs[-1].lnum }
for sign in a:signs for sign in a:signs
" Preserve non-signify signs " Preserve non-signify signs
if !g:signify_sign_overwrite && has_key(s:other_signs_line_numbers, sign.lnum) if !g:signify_sign_overwrite && has_key(s:other_signs_line_numbers, sign.lnum)
next continue
endif endif
call add(hunk.ids, g:id_top) call add(hunk.ids, g:id_top)
execute 'sign place '. g:id_top .' line='. sign.lnum .' name='. sign.type .' file='. sign.path execute 'sign place' g:id_top 'line='. sign.lnum 'name='. sign.type 'file='. sign.path
let g:id_top += 1 let g:id_top += 1
endfor endfor
call add(g:sy[sign.path].hunks, hunk) call add(g:sy[sign.path].hunks, hunk)
endfunction endfunction
" Function: #remove_all {{{1 " Function: #remove_all {{{1
function! sy#sign#remove_all(path) abort function! sy#sign#remove_all(path) abort
if g:signify_sign_overwrite
sign unplace *
else
for hunk in g:sy[a:path].hunks for hunk in g:sy[a:path].hunks
for id in hunk.ids for id in hunk.ids
execute 'sign unplace '. id execute 'sign unplace' id
endfor endfor
endfor endfor
endif
let s:other_signs_line_numbers = {} let s:other_signs_line_numbers = {}
let g:sy[a:path].hunks = [] let g:sy[a:path].hunks = []
let g:sy[a:path].stats = [0, 0, 0] let g:sy[a:path].stats = [0, 0, 0]
endfunction endfunction
" vim: et sw=2 sts=2 " vim: et sw=2 sts=2