mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-08 22:54:45 +02:00
Merge pull request #1250 from chrisbra/1233
Do not unconditionally modify airline_c_inactive
This commit is contained in:
commit
afee79bbe0
@ -188,7 +188,7 @@ function! airline#check_mode(winnr)
|
||||
let mode_string = join(l:mode)
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode)
|
||||
call airline#highlighter#highlight(l:mode, context.bufnr)
|
||||
let w:airline_lastmode = mode_string
|
||||
endif
|
||||
|
||||
|
@ -47,6 +47,9 @@ function! s:prototype.build()
|
||||
let contents = section[1]
|
||||
let pgroup = prev_group
|
||||
let prev_group = s:get_prev_group(self._sections, i)
|
||||
if group ==# 'airline_c' && !self._context.active
|
||||
let group = 'airline_c'. self._context.bufnr
|
||||
endif
|
||||
if is_empty
|
||||
let prev_group = pgroup
|
||||
endif
|
||||
@ -87,6 +90,7 @@ function! s:prototype.build()
|
||||
endwhile
|
||||
|
||||
if !self._context.active
|
||||
"let line = substitute(line, '%#airline_c#', '%#airline_c'.self._context.bufnr.'#', '')
|
||||
let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g')
|
||||
endif
|
||||
return line
|
||||
|
@ -136,7 +136,8 @@ function! airline#highlighter#highlight_modified_inactive(bufnr)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight(modes)
|
||||
function! airline#highlighter#highlight(modes, ...)
|
||||
let bufnr = a:0 ? a:1 : ''
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
" draw the base mode, followed by any overrides
|
||||
@ -147,7 +148,11 @@ function! airline#highlighter#highlight(modes)
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
let mode_colors = kvp[1]
|
||||
call airline#highlighter#exec(kvp[0].suffix, mode_colors)
|
||||
let name = kvp[0]
|
||||
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
|
||||
let name = 'airline_c'.bufnr
|
||||
endif
|
||||
call airline#highlighter#exec(name.suffix, mode_colors)
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
@ -165,7 +170,7 @@ function! airline#highlighter#highlight(modes)
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors)
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user