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:
|
||||
mode = vim_mode()
|
||||
contents_override = None
|
||||
self.window_cache[window_id] = {segment['key']: segment['contents'] for segment in self.segments if segment['type'] == 'function'}
|
||||
else:
|
||||
mode = 'nc'
|
||||
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 = 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
|
||||
|
||||
def hl(self, fg=None, bg=None, attr=None):
|
||||
|
|
Loading…
Reference in New Issue