mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-25 23:14:50 +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
|
endfunction
|
||||||
|
|
||||||
" There still is a highlighting bug when using groups %(%) in the statusline,
|
" There still is a highlighting bug when using groups %(%) in the statusline,
|
||||||
" deactivate it, until this is properly fixed:
|
" deactivate it, unless it is fixed (7.4.1511)
|
||||||
" https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
|
|
||||||
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
|
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)
|
||||||
|
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
|
" 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
|
||||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
if (a:key == 'warning' || a:key == 'error')
|
if condition
|
||||||
call a:builder.add_raw('%(')
|
call a:builder.add_raw('%(')
|
||||||
endif
|
endif
|
||||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
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('%)')
|
call a:builder.add_raw('%)')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user