diff --git a/autoload/airline/extensions/default.vim b/autoload/airline/extensions/default.vim index c24a1f5f..4ae686ce 100644 --- a/autoload/airline/extensions/default.vim +++ b/autoload/airline/extensions/default.vim @@ -23,14 +23,18 @@ function! s:get_section(winnr, key, ...) return empty(text) ? '' : prefix.text.suffix endfunction -function! s:build_sections(builder, keys, winnr) +function! s:build_sections(builder, context, keys) for key in a:keys + if key == 'warning' && !a:context.active + continue + endif + " i have no idea why the warning section needs special treatment, but it's " needed to prevent separators from showing up if key == 'warning' call a:builder.add_raw('%(') endif - call a:builder.add_section('airline_'.key, s:get_section(a:winnr, key)) + call a:builder.add_section('airline_'.key, s:get_section(a:context.winnr, key)) if key == 'warning' call a:builder.add_raw('%)') endif @@ -42,7 +46,7 @@ function! airline#extensions#default#apply(builder, context) let active = a:context.active if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) - call build_sections(a:builder, s:layout[0], winnr) + call build_sections(a:builder, a:context, s:layout[0]) else call a:builder.add_section('airline_a', '%f%m ') call a:builder.add_section('airline_c', '') @@ -51,7 +55,7 @@ function! airline#extensions#default#apply(builder, context) call a:builder.split(s:get_section(winnr, 'gutter', '', '')) if airline#util#getwinvar(winnr, 'airline_render_right', 1) - call build_sections(a:builder, s:layout[1], winnr) + call build_sections(a:builder, a:context, s:layout[1]) endif return 1