1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:30:05 +08:00

fix(tabline): fix tabline fold

close https://github.com/SpaceVim/SpaceVim/issues/4550
This commit is contained in:
wsdjeg 2022-01-01 22:10:18 +08:00
parent 176261652e
commit 8e4183185c

View File

@ -94,18 +94,29 @@ function! s:wrap_id(id) abort
return id . ' ' return id . ' '
endfunction endfunction
" build the tab item, the first argv is bufnr, and the second argv is tabnr
function! s:buffer_item(bufnr, ...) abort function! s:buffer_item(bufnr, ...) abort
let name = s:tabname(a:bufnr) let name = s:tabname(a:bufnr)
let tabnr = get(a:000, 0, -1)
if tabnr != -1
let tabname = gettabvar(tabnr, '_spacevim_tab_name', '')
let len = strlen(tabname) + 3
else
let tabname = ''
let len = strlen(name) + 3
endif
let item = { let item = {
\ 'bufnr' : a:bufnr, \ 'bufnr' : a:bufnr,
\ 'len' : strlen(name) + 3, \ 'len' : len,
\ 'bufname' : name, \ 'bufname' : name,
\ 'tabnr' : get(a:000, 0, -1), \ 'tabname' : tabname,
\ 'tabnr' : tabnr,
\ } \ }
return item return item
endfunction endfunction
" check if the items len longer than &columns " check if the items len longer than &columns
" the check_len function should also check the tab name.
function! s:check_len(items) abort function! s:check_len(items) abort
let len = 0 let len = 0
for item in a:items for item in a:items