Try to avoid excessive redraws.
Most of them seem to be caused by using :hi statements, although the highlighting group to be created is exactly the same. Therefore, get the info from actual definition and only execute :hi when the new group is actually different. Also try to avoid to generate :hi statements when the popupmen is visible. This causes flickers.
This commit is contained in:
parent
0ced03ebf3
commit
af3f209d7a
|
@ -59,6 +59,9 @@ function! s:update_tabline()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#load_theme(palette)
|
function! airline#extensions#tabline#load_theme(palette)
|
||||||
|
if pumvisible()
|
||||||
|
return
|
||||||
|
endif
|
||||||
let colors = get(a:palette, 'tabline', {})
|
let colors = get(a:palette, 'tabline', {})
|
||||||
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
|
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
|
||||||
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
||||||
|
|
|
@ -59,23 +59,40 @@ function! airline#highlighter#get_highlight2(fg, bg, ...)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#highlighter#exec(group, colors)
|
function! airline#highlighter#exec(group, colors)
|
||||||
|
if pumvisible()
|
||||||
|
return
|
||||||
|
endif
|
||||||
let colors = a:colors
|
let colors = a:colors
|
||||||
if s:is_win32term
|
if s:is_win32term
|
||||||
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||||
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||||
endif
|
endif
|
||||||
exec printf('hi %s %s %s %s %s %s %s %s',
|
let cmd= printf('hi %s %s %s %s %s %s %s %s',
|
||||||
\ a:group,
|
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
|
||||||
\ get(colors, 0, '') isnot# '' ? 'guifg='.colors[0] : '',
|
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
|
||||||
\ get(colors, 1, '') isnot# '' ? 'guibg='.colors[1] : '',
|
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
|
||||||
\ get(colors, 2, '') isnot# '' ? 'ctermfg='.colors[2] : '',
|
\ s:Get(colors, 4, 'term=', ''))
|
||||||
\ get(colors, 3, '') isnot# '' ? 'ctermbg='.colors[3] : '',
|
let old_hi = airline#highlighter#get_highlight(a:group)
|
||||||
\ get(colors, 4, '') isnot# '' ? 'gui='.colors[4] : '',
|
if len(colors) == 4
|
||||||
\ get(colors, 4, '') isnot# '' ? 'cterm='.colors[4] : '',
|
call add(colors, '')
|
||||||
\ get(colors, 4, '') isnot# '' ? 'term='.colors[4] : '')
|
endif
|
||||||
|
if old_hi != colors
|
||||||
|
exe cmd
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:Get(dict, key, prefix, default)
|
||||||
|
if get(a:dict, a:key, a:default) isnot# a:default
|
||||||
|
return a:prefix. get(a:dict, a:key)
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:exec_separator(dict, from, to, inverse, suffix)
|
function! s:exec_separator(dict, from, to, inverse, suffix)
|
||||||
|
if pumvisible()
|
||||||
|
return
|
||||||
|
endif
|
||||||
let l:from = airline#themes#get_highlight(a:from.a:suffix)
|
let l:from = airline#themes#get_highlight(a:from.a:suffix)
|
||||||
let l:to = airline#themes#get_highlight(a:to.a:suffix)
|
let l:to = airline#themes#get_highlight(a:to.a:suffix)
|
||||||
let group = a:from.'_to_'.a:to.a:suffix
|
let group = a:from.'_to_'.a:to.a:suffix
|
||||||
|
@ -89,6 +106,9 @@ function! s:exec_separator(dict, from, to, inverse, suffix)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#highlighter#load_theme()
|
function! airline#highlighter#load_theme()
|
||||||
|
if pumvisible()
|
||||||
|
return
|
||||||
|
endif
|
||||||
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||||
endfor
|
endfor
|
||||||
|
|
Loading…
Reference in New Issue