Simplify sign ID handling
This commit is contained in:
parent
b839e8092f
commit
304a2b9c27
@ -3,7 +3,6 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
" Init: values {{{1
|
||||
let g:id_top = 0x100
|
||||
let g:sy_cache = {}
|
||||
|
||||
let s:has_doau_modeline = v:version > 703 || v:version == 703 && has('patch442')
|
||||
@ -49,7 +48,7 @@ function! sy#start() abort
|
||||
\ 'active': 0,
|
||||
\ 'vcs' : 'unknown',
|
||||
\ 'hunks' : [],
|
||||
\ 'id_top': g:id_top,
|
||||
\ 'signid': 0x100,
|
||||
\ 'stats' : [-1, -1, -1] }
|
||||
if get(g:, 'signify_disable_by_default')
|
||||
call sy#verbose('Disabled by default.')
|
||||
@ -92,7 +91,6 @@ function! sy#set_signs(diff, do_register) abort
|
||||
endif
|
||||
|
||||
call sy#sign#process_diff(a:diff)
|
||||
let b:sy.id_top = (g:id_top - 1)
|
||||
|
||||
if exists('#User#Signify')
|
||||
execute 'doautocmd' (s:has_doau_modeline ? '<nomodeline>' : '') 'User Signify'
|
||||
|
@ -14,7 +14,7 @@ function! sy#debug#list_active_buffers() abort
|
||||
|
||||
echo "\n". path ."\n". repeat('=', strlen(path))
|
||||
|
||||
for k in ['active', 'buffer', 'vcs', 'stats', 'id_top']
|
||||
for k in ['active', 'buffer', 'vcs', 'stats', 'signid']
|
||||
if k == 'stats'
|
||||
echo printf("%10s = %d added, %d changed, %d removed\n",
|
||||
\ k,
|
||||
|
@ -80,7 +80,7 @@ function! sy#repo#get_diff_start(vcs, do_register) abort
|
||||
execute b:sy_info.chdir b:sy_info.cwd
|
||||
endtry
|
||||
else
|
||||
let diff = split(s:run(g:signify_vcs_cmds[a:vcs], b:sy_info.path), '\n')
|
||||
let diff = split(s:run(a:vcs), '\n')
|
||||
call sy#repo#get_diff_{a:vcs}(v:shell_error, diff, a:do_register)
|
||||
endif
|
||||
endfunction
|
||||
@ -88,9 +88,6 @@ endfunction
|
||||
" Function: s:get_diff_end {{{1
|
||||
function! s:get_diff_end(found_diff, vcs, diff, do_register) abort
|
||||
call sy#verbose('s:get_diff_end()', a:vcs)
|
||||
if !a:do_register
|
||||
let b:sy.id_top = g:id_top
|
||||
endif
|
||||
if a:found_diff
|
||||
let b:sy.vcs = a:vcs
|
||||
call sy#set_signs(a:diff, a:do_register)
|
||||
|
@ -12,11 +12,11 @@ else
|
||||
endif
|
||||
let s:delete_highlight = ['', 'SignifyLineDelete']
|
||||
|
||||
" Function: #get_next_id {{{1
|
||||
function! sy#sign#get_next_id() abort
|
||||
let tmp = g:id_top
|
||||
let g:id_top += 1
|
||||
return tmp
|
||||
" Function: #id_next {{{1
|
||||
function! sy#sign#id_next() abort
|
||||
let id = b:sy.signid
|
||||
let b:sy.signid += 1
|
||||
return id
|
||||
endfunction
|
||||
|
||||
" Function: #get_current_signs {{{1
|
||||
@ -196,7 +196,7 @@ function! sy#sign#remove_all_signs(bufnr) abort
|
||||
|
||||
for hunk in sy.hunks
|
||||
for id in hunk.ids
|
||||
execute 'sign unplace' id
|
||||
execute 'sign unplace' id 'buffer='.a:bufnr
|
||||
endfor
|
||||
endfor
|
||||
|
||||
@ -220,7 +220,7 @@ function! s:add_sign(line, type, ...) abort
|
||||
endif
|
||||
|
||||
if !exists('id')
|
||||
let id = sy#sign#get_next_id()
|
||||
let id = sy#sign#id_next()
|
||||
endif
|
||||
|
||||
if a:type =~# 'SignifyDelete'
|
||||
|
Loading…
x
Reference in New Issue
Block a user