mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-24 14:35:32 +02:00
Do not add extra %( %) in the statusline
This was used as a workaround to fix a highlighting bug, which was fixed in Vim 7.4.1511 and therefore, we need to correctly detect that the patch was applied and in that case skip adding those extra groups. As a bonus, when not using those empty %( %) groups, the skip_empty_section test will correctly handle this and therefore this closes #1351
This commit is contained in:
parent
7cd7972bbe
commit
c375d050a8
@ -42,20 +42,21 @@ function! s:build_sections(builder, context, keys)
|
||||
endfunction
|
||||
|
||||
" 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
|
||||
" deactivate it, unless it is fixed (7.4.1511)
|
||||
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
|
||||
function! s:add_section(builder, context, key)
|
||||
let condition = '(a:key is# "warning" || a:key is# "error")'.
|
||||
\ '&& (v:version == 704 && !has("patch1511"))'
|
||||
" i have no idea why the warning section needs special treatment, but it's
|
||||
" needed to prevent separators from showing up
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
if (a:key == 'warning' || a:key == 'error')
|
||||
if condition
|
||||
call a:builder.add_raw('%(')
|
||||
endif
|
||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||
if (a:key == 'warning' || a:key == 'error')
|
||||
if condition
|
||||
call a:builder.add_raw('%)')
|
||||
endif
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user