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