tabline: missing spaces

commit ab49a1c7aea5e77 changed that no leading whitespace was added.
While this removed a double space in front of the current active
selected buffer, it removed one space too much for the non-current
buffers in the bufferline.

So partly reverse it and only add the space, if the highlighting groups
between each item did not change.
This commit is contained in:
Christian Brabandt 2018-01-08 09:48:36 +01:00
parent 182675dc10
commit 02816a3cb6
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -69,6 +69,7 @@ function! airline#extensions#tabline#buffers#get()
if show_buf_label_first if show_buf_label_first
call airline#extensions#tabline#add_label(b, 'buffers') call airline#extensions#tabline#add_label(b, 'buffers')
endif endif
let pgroup = ''
for nr in s:get_visible_buffers() for nr in s:get_visible_buffers()
if nr < 0 if nr < 0
call b.add_raw('%#airline_tabhid#...') call b.add_raw('%#airline_tabhid#...')
@ -86,20 +87,23 @@ function! airline#extensions#tabline#buffers#get()
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@') call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
endif endif
let space= (pgroup == group ? s:spc: '')
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
if len(s:number_map) > 0 if len(s:number_map) > 0
call b.add_section(group, get(s:number_map, index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc) call b.add_section(group, space. get(s:number_map, index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
else else
call b.add_section(group, '['.index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']') call b.add_section(group, '['.index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
endif endif
let index += 1 let index += 1
else else
call b.add_section(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc) call b.add_section(group, space.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
endif endif
if has("tablineat") if has("tablineat")
call b.add_raw('%X') call b.add_raw('%X')
endif endif
let pgroup=group
endfor endfor
call b.add_section('airline_tabfill', '') call b.add_section('airline_tabfill', '')