Fix highlighting problems with Vim

1) Make sure airline_error and airline_warning highlighting are
   different, so that the correct separator will be drawn. This
   fixes #982.

2) allow to deactivate %(%) to workaround a vim bug, that may cause
   leaking of colors from one section to the next and adding additional
   spaces. This needs to be fixed upstream:
   https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
   Possibly, also related to neovim/neovim#4147
   Use `:let airline#extensions#default#section_use_groupitems = 0`
   to disable grouping of statusline items
This commit is contained in:
Christian Brabandt 2016-02-02 20:32:30 +01:00
parent da3f3bf1d7
commit f57c5daf66
3 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,7 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling. " MIT License. Copyright (c) 2013-2016 Bailey Ling.
" vim: et ts=2 sts=2 sw=2 " vim: et ts=2 sts=2 sw=2
let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1)
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
\ 'b': 79, \ 'b': 79,
\ 'x': 60, \ 'x': 60,
@ -35,7 +36,10 @@ function! s:build_sections(builder, context, keys)
endfor endfor
endfunction endfunction
if v:version >= 704 || (v:version >= 703 && has('patch81')) " There still is a highlighting bug when using groups %(%) in the statusline,
" deactivate it, until this is properly fixed:
" https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
function s:add_section(builder, context, key) function s:add_section(builder, context, key)
" i have no idea why the warning section needs special treatment, but it's " i have no idea why the warning section needs special treatment, but it's
" needed to prevent separators from showing up " needed to prevent separators from showing up

View File

@ -40,7 +40,7 @@ function! airline#themes#patch(palette)
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 190 ] let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 190 ]
endif endif
if !has_key(a:palette[mode], 'airline_error') if !has_key(a:palette[mode], 'airline_error')
let a:palette[mode]['airline_error'] = [ '#000000', '#df5f00', 232, 160 ] let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
endif endif
endfor endfor

View File

@ -285,6 +285,10 @@ configuration values that you can use.
\ [ 'x', 'y', 'z', 'error', 'warning' ] \ [ 'x', 'y', 'z', 'error', 'warning' ]
\ ] \ ]
< <
* configure the layout to not use %(%) grouping items in the statusline.
Try setting this to zero, if you notice bleeding color artifacts >
let airline#extensions#default#section_use_groupitems = 1
<
------------------------------------- *airline-quickfix* ------------------------------------- *airline-quickfix*
The quickfix extension is a simple built-in extension which determines The quickfix extension is a simple built-in extension which determines
whether the buffer is a quickfix or location list buffer, and adjusts the whether the buffer is a quickfix or location list buffer, and adjusts the