Signs: do not exceed two cells
This is only enforced for dynamically created signs, namely g:signify_sign_delete and g:signify_sign_changedelete, if g:signify_sign_show_count is on. References https://github.com/mhinz/vim-signify/issues/105
This commit is contained in:
parent
1bdf100aad
commit
ed51cb2599
@ -14,6 +14,7 @@ else
|
||||
let s:sign_change = ' '
|
||||
let s:sign_changedelete = ' '
|
||||
endif
|
||||
|
||||
let s:sign_show_count = get(g:, 'signify_sign_show_count', 1)
|
||||
|
||||
" Function: #setup {{{1
|
||||
@ -60,7 +61,9 @@ function! sy#highlight#line_disable() abort
|
||||
execute 'sign define SignifyRemoveFirstLine text='. s:sign_delete_first_line 'texthl=SignifySignDeleteFirstLine linehl='
|
||||
|
||||
if s:sign_show_count
|
||||
let s:sign_changedelete = substitute(s:sign_changedelete, '^.\zs.*', '', '')
|
||||
while strwidth(s:sign_changedelete) > 1
|
||||
let s:sign_changedelete = substitute(s:sign_changedelete, '.', '', '')
|
||||
endwhile
|
||||
for n in range(1, 9)
|
||||
execute 'sign define SignifyChangeDelete'. n 'text='. s:sign_changedelete . n 'texthl=SignifySignChangeDelete linehl='
|
||||
endfor
|
||||
|
@ -96,11 +96,10 @@ function! sy#sign#process_diff(sy, vcs, diff) abort
|
||||
if new_line == 0
|
||||
call add(ids, s:add_sign(a:sy, 1, 'SignifyRemoveFirstLine'))
|
||||
elseif s:sign_show_count
|
||||
if old_count <= 99
|
||||
let text = substitute(s:sign_delete . old_count, '.*\ze..$', '', '')
|
||||
else
|
||||
let text = s:sign_delete .'>'
|
||||
endif
|
||||
let text = s:sign_delete . (old_count <= 99 ? old_count : '>')
|
||||
while strwidth(text) > 2
|
||||
let text = substitute(text, '.', '', '')
|
||||
endwhile
|
||||
call add(ids, s:add_sign(a:sy, new_line, 'SignifyDelete'. old_count, text))
|
||||
else
|
||||
call add(ids, s:add_sign(a:sy, new_line, 'SignifyDeleteMore', s:sign_delete))
|
||||
|
Loading…
x
Reference in New Issue
Block a user