Tabline performance: only pass in visible buffers to formatters
This only passes in the list of visible buffers on that tab, which reduces the processing a lot if you have a lot of buffers opened.
This commit is contained in:
parent
7b9b68f15d
commit
8d681c7119
|
@ -138,14 +138,17 @@ function! airline#extensions#tabline#title(n)
|
||||||
if empty(title)
|
if empty(title)
|
||||||
let buflist = tabpagebuflist(a:n)
|
let buflist = tabpagebuflist(a:n)
|
||||||
let winnr = tabpagewinnr(a:n)
|
let winnr = tabpagewinnr(a:n)
|
||||||
return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1])
|
let all_buffers = airline#extensions#tabline#buflist#list()
|
||||||
|
return airline#extensions#tabline#get_buffer_name(
|
||||||
|
\ buflist[winnr - 1],
|
||||||
|
\ filter(buflist, 'index(all_buffers, v:val) != -1'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return title
|
return title
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
function! airline#extensions#tabline#get_buffer_name(nr, buffers)
|
||||||
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, airline#extensions#tabline#buflist#list())
|
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, a:buffers)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#new_builder()
|
function! airline#extensions#tabline#new_builder()
|
||||||
|
|
Loading…
Reference in New Issue