Create VimPowerline.reset_highlight proxy method

Fixes #411
This commit is contained in:
ZyX 2013-04-09 00:37:53 +04:00
parent a7daa507ab
commit de678ed289
2 changed files with 12 additions and 1 deletions

View File

@ -82,7 +82,7 @@ function! PowerlineRegisterCachePurgerEvent(event)
endfunction
augroup Powerline
autocmd! ColorScheme * :exec s:powerline_pycmd 'powerline.renderer.reset_highlight()'
autocmd! ColorScheme * :exec s:powerline_pycmd 'powerline.reset_highlight()'
autocmd! VimEnter * :redrawstatus!
autocmd! VimLeavePre * :exec s:powerline_pycmd 'powerline.shutdown()'
augroup END

View File

@ -82,3 +82,14 @@ class VimPowerline(Powerline):
@staticmethod
def get_segment_info():
return {}
def reset_highlight(self):
try:
self.renderer.reset_highlight()
except AttributeError:
# Renderer object appears only after first `.render()` call. Thus if
# ColorScheme event happens before statusline is drawn for the first
# time AttributeError will be thrown for the self.renderer. It is
# fine to ignore it: no renderer == no colors to reset == no need to
# do anything.
pass