def render(self, window=None, window_id=None, winnr=None, is_tabline=False): '''Render all segments.''' segment_info = self.segment_info.copy() if window is vim.current.window: mode = vim_mode() mode = mode_translations.get(mode, mode) else: mode = 'nc' segment_info.update( window=window, mode=mode, window_id=window_id, winnr=winnr, buffer=window.buffer, tabpage=current_tabpage(), encoding=self.encoding, ) segment_info['tabnr'] = segment_info['tabpage'].number segment_info['bufnr'] = segment_info['buffer'].number if is_tabline: winwidth = int(vim_getoption('columns')) else: winwidth = segment_info['window'].width statusline = super(VimRenderer, self).render( mode=mode, width=winwidth, segment_info=segment_info, matcher_info=(None if is_tabline else segment_info), ) statusline = statusline.encode(self.encoding, self.strwidth_error_name) return statusline