Fix performance issue with tabline and showtabline=2

vim_getbufoption(segment, 'buflisted') was causing vim to update the tabline for every
keystroke. using vim.eval('buflisted(nr)') allows vim to optimize when
it needs to update

Fixes #1281
This commit is contained in:
John Drouhard 2015-11-14 12:38:07 -06:00
parent 4e7f39926a
commit 6efabc170d
1 changed files with 8 additions and 17 deletions

View File

@ -89,22 +89,13 @@ def bufferlister(pl, segment_info, show_unlisted=False, **kwargs):
return dct
return (
(
buf_segment_info,
add_multiplier(buf_segment_info['buffer'], {'highlight_group_prefix': prefix})
)
for buf_segment_info, prefix in (
(
buffer_updated_segment_info(
segment_info,
buffer
),
('buf' if buffer is cur_buffer else 'buf_nc')
)
for buffer in vim.buffers
) if (
buf_segment_info['buffer'] is cur_buffer
or show_unlisted
or int(vim_getbufoption(buf_segment_info, 'buflisted'))
(lambda buffer, prefix: (
buffer_updated_segment_info(segment_info, buffer),
add_multiplier(buffer, {'highlight_group_prefix': prefix}
))(buffer, 'buf' if buffer is cur_buffer else 'buf_nc')
for buffer in vim.buffers if (
buffer is cur_buffer
or show_unlisted
or int(vim.eval('buflisted(%s)' % buffer.number)) > 0
)
)