mirror of
https://github.com/powerline/powerline.git
synced 2025-04-08 19:25:04 +02:00
Cache segment contents after rendering the statusline
Non-current segments used the wrong contents because outdated information was cached (self.segments was repopulated in the render() method which was called *after* the contents was cached). Now the contents are cached after the parent class' render() method is called so the correct information is cached. Closes #11.
This commit is contained in:
parent
2a4baa0a59
commit
70818341e6
@ -36,7 +36,6 @@ class VimRenderer(Renderer):
|
|||||||
if current:
|
if current:
|
||||||
mode = vim_mode()
|
mode = vim_mode()
|
||||||
contents_override = None
|
contents_override = None
|
||||||
self.window_cache[window_id] = {segment['key']: segment['contents'] for segment in self.segments if segment['type'] == 'function'}
|
|
||||||
else:
|
else:
|
||||||
mode = 'nc'
|
mode = 'nc'
|
||||||
contents_override = self.window_cache.get(window_id)
|
contents_override = self.window_cache.get(window_id)
|
||||||
@ -44,6 +43,9 @@ class VimRenderer(Renderer):
|
|||||||
statusline = super(VimRenderer, self).render(mode, width=winwidth, contents_override=contents_override)
|
statusline = super(VimRenderer, self).render(mode, width=winwidth, contents_override=contents_override)
|
||||||
statusline = statusline.replace(self.PERCENT_PLACEHOLDER, '%%')
|
statusline = statusline.replace(self.PERCENT_PLACEHOLDER, '%%')
|
||||||
|
|
||||||
|
if current:
|
||||||
|
self.window_cache[window_id] = {segment['key']: segment['contents'] for segment in self.segments if segment['type'] == 'function'}
|
||||||
|
|
||||||
return statusline
|
return statusline
|
||||||
|
|
||||||
def hl(self, fg=None, bg=None, attr=None):
|
def hl(self, fg=None, bg=None, attr=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user