highligher: fix the comparison before redefining hi group

The comparison in airline#highlighter#exec() was there to prevent to
call out to too many :hi calls by making sure that the newly to be
defined highlighting group will be actually different from the current
existing one.

However, that did not work, as the returned old highlight
group did never match the newly to be created one, since it
intentionally left the cterm attributes out for the gui and the gui
attributes for the terminal.

Therefore, fix the comparasion and make it compare the actual values
that we have.

This should make vim-airline a bit faster (hopefully!)
This commit is contained in:
Christian Brabandt 2017-06-26 22:27:01 +02:00
parent f86f1e8103
commit 560092a9ec
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -84,8 +84,13 @@ function! airline#highlighter#exec(group, colors)
if len(colors) == 4
call add(colors, '')
endif
if g:airline_gui_mode ==# 'gui'
let new_hi = [colors[0], colors[1], '', '', colors[4]]
else
let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]]
endif
let colors = s:CheckDefined(colors)
if old_hi != colors || !s:hl_group_exists(a:group)
if old_hi != new_hi || !s:hl_group_exists(a:group)
let cmd = printf('hi %s %s %s %s %s %s %s %s',
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),