Use the partially built tabline to calculate space left for tabs

This commit is contained in:
mrmr1993 2018-03-12 20:31:50 +00:00
parent 7a286639c5
commit e0791cc1a0

View File

@ -123,7 +123,15 @@ function! airline#extensions#tabline#tabs#get()
call airline#extensions#tabline#add_label(b, 'buffers')
endif
for i in s:get_visible_tabs(&columns)
let b_tabline = b.build()
let b_tabline = substitute(b_tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g')
let b_tabline = substitute(b_tabline, '%#[^#]\+#', '', 'g')
let b_tabline = substitute(b_tabline, '%(\([^)]\+\))', '\1', 'g')
let b_tabline = substitute(b_tabline, '%\d\+[TX]', '', 'g')
let b_tabline = substitute(b_tabline, '%=', '', 'g')
let b_tabline = substitute(b_tabline, '%\d*\*', '', 'g')
for i in s:get_visible_tabs(&columns - strlen(b_tabline))
if i < 0
call b.insert_raw('%#airline_tab#...', tabs_position)
let tabs_position += 1