Merge pull request #701 from blueyed/fix-get_buffer_list-cache-2

Fix get_buffer_list cache 2
This commit is contained in:
Bailey Ling 2015-02-11 07:27:27 -05:00
commit 1e35ad5d77
1 changed files with 6 additions and 5 deletions

View File

@ -61,19 +61,20 @@ function! s:toggle_on()
set tabline=%!airline#extensions#tabline#get()
augroup airline_tabline
autocmd!
" Invalidate cache.
autocmd BufAdd,BufUnload * unlet! s:current_buffer_list
if s:buf_min_count <= 0 && s:tab_min_count <= 1
set showtabline=2
else
if s:show_buffers == 1
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()))
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()))
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1)
else
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
endif
endif
" Invalidate cache. This has to come after the BufUnload for
" s:show_buffers, to invalidate the cache for BufEnter.
autocmd BufAdd,BufUnload * unlet! s:current_buffer_list
augroup END
endfunction