Merge pull request #1211 from JulienPivard/patch-1

Hunks not show in airline with signify and option g:airline#extension…
This commit is contained in:
Christian Brabandt 2016-07-25 10:00:48 +02:00 committed by GitHub
commit 4b5441a8f7
1 changed files with 5 additions and 3 deletions

View File

@ -45,7 +45,7 @@ function! s:get_hunks_empty()
endfunction endfunction
function! s:get_hunks() function! s:get_hunks()
if !exists('b:source_func') if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
if get(g:, 'loaded_signify') && sy#buffer_is_active() if get(g:, 'loaded_signify') && sy#buffer_is_active()
let b:source_func = 's:get_hunks_signify' let b:source_func = 's:get_hunks_signify'
elseif exists('*GitGutterGetHunkSummary') elseif exists('*GitGutterGetHunkSummary')
@ -67,8 +67,10 @@ function! airline#extensions#hunks#get_hunks()
endif endif
" Cache vavlues, so that it isn't called too often " Cache vavlues, so that it isn't called too often
if exists("b:airline_hunks") && if exists("b:airline_hunks") &&
\ get(b:, 'airline_changenr', 0) == changenr() && \ get(b:, 'airline_changenr', 0) == changenr() &&
\ winwidth(0) == get(s:, 'airline_winwidth', 0) \ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty'
return b:airline_hunks return b:airline_hunks
endif endif
let hunks = s:get_hunks() let hunks = s:get_hunks()