mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-26 18:31:02 +08:00
tabline: Use separate hi group for label on right
if the same highlighting group is used on the left and right for the label, the `airline_tablabel_to_airline_tabmod` will be overwritten on the right side, causing the fg/bg colors to be wrong, because on the right side they have to be the opposite of the left side. So use a separate highlighting group for the tablabel on the right. closes #1902
This commit is contained in:
parent
d1d9548b8e
commit
6acb234a12
|
@ -113,6 +113,8 @@ function! airline#extensions#tabline#load_theme(palette)
|
|||
call airline#highlighter#exec('airline_tabhid', tabhid)
|
||||
|
||||
" Theme for tabs on the right
|
||||
" label on the right
|
||||
let tablabel_r = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
|
||||
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
|
||||
let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
|
||||
let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
|
||||
|
@ -123,6 +125,7 @@ function! airline#extensions#tabline#load_theme(palette)
|
|||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tablabel_right', tablabel_r)
|
||||
call airline#highlighter#exec('airline_tab_right', tab_right)
|
||||
call airline#highlighter#exec('airline_tabsel_right', tabsel_right)
|
||||
call airline#highlighter#exec('airline_tabmod_right', tabmod_right)
|
||||
|
@ -222,9 +225,10 @@ function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
|||
return group
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#add_label(dict, type)
|
||||
function! airline#extensions#tabline#add_label(dict, type, right)
|
||||
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
call a:dict.add_section_spaced('airline_tablabel',
|
||||
call a:dict.add_section_spaced('airline_tablabel'.
|
||||
\ (a:right ? '_right' : ''),
|
||||
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type))
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -69,7 +69,7 @@ function! airline#extensions#tabline#buffers#get()
|
|||
let show_buf_label_first = 1
|
||||
endif
|
||||
if show_buf_label_first
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
call airline#extensions#tabline#add_label(b, 'buffers', 0)
|
||||
endif
|
||||
|
||||
let b.tab_bufs = tabpagebuflist(tabpagenr())
|
||||
|
@ -137,7 +137,7 @@ function! airline#extensions#tabline#buffers#get()
|
|||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
if !show_buf_label_first
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
call airline#extensions#tabline#add_label(b, 'buffers', 1)
|
||||
endif
|
||||
|
||||
call airline#extensions#tabline#add_tab_label(b)
|
||||
|
|
|
@ -41,7 +41,7 @@ function! airline#extensions#tabline#tabs#get()
|
|||
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
call airline#extensions#tabline#add_label(b, 'tabs')
|
||||
call airline#extensions#tabline#add_label(b, 'tabs', 0)
|
||||
|
||||
function! b.get_group(i) dict
|
||||
let curtab = tabpagenr()
|
||||
|
@ -89,7 +89,7 @@ function! airline#extensions#tabline#tabs#get()
|
|||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||
endfor
|
||||
if get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
call airline#extensions#tabline#add_label(b, 'buffers')
|
||||
call airline#extensions#tabline#add_label(b, 'buffers', 1)
|
||||
endif
|
||||
endif
|
||||
call airline#extensions#tabline#add_tab_label(b)
|
||||
|
|
Loading…
Reference in New Issue
Block a user