tabline: fix cache invalidation for show_buffers=1 with `:bd`

Ref: https://github.com/bling/vim-airline/pull/700#issuecomment-73798679
This commit is contained in:
Daniel Hahler 2015-02-11 00:31:39 +01:00
parent b6accd91c8
commit 98c2dbd04e
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() set tabline=%!airline#extensions#tabline#get()
augroup airline_tabline augroup airline_tabline
autocmd! autocmd!
" Invalidate cache.
autocmd BufAdd,BufUnload * unlet! s:current_buffer_list
if s:buf_min_count <= 0 && s:tab_min_count <= 1 if s:buf_min_count <= 0 && s:tab_min_count <= 1
set showtabline=2 set showtabline=2
else else
if s:show_buffers == 1 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) autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(s:get_buffer_list()) - 1)
else 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
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 augroup END
endfunction endfunction