Update vim test module to implement 'getbufvar(...)'

This allows the tests for the buffer tablist to pass, since it now uses
getbufvar(nr, '&modified') to detect whether the buffer needs to be
modified
This commit is contained in:
John Drouhard 2015-11-14 14:40:51 -06:00
parent 63214c8a79
commit a85b54d923
2 changed files with 9 additions and 1 deletions

View File

@ -102,7 +102,7 @@ def bufferlister(pl, segment_info, show_unlisted=False, **kwargs):
))(
buffer,
'buf' if buffer is cur_buffer else 'buf_nc',
'_mod' if int(vim.eval('getbufvar(%s, \'&mod\')' % buffer.number)) > 0 else ''
'_mod' if int(vim.eval('getbufvar(%s, \'&modified\')' % buffer.number)) > 0 else ''
)
for buffer in vim.buffers if (
buffer is cur_buffer

View File

@ -265,6 +265,14 @@ def eval(expr):
import os
assert os.path.basename(current.buffer.name).startswith('NERD_tree_')
return '/usr/include'
elif expr.startswith('getbufvar('):
import re
match = re.match(r'^getbufvar\((\d+), ["\'](.+)["\']\)$', expr)
if not match:
raise NotImplementedError(expr)
bufnr = int(match.group(1))
varname = match.group(2)
return _emul_getbufvar(bufnr, varname)
elif expr == 'tabpagenr()':
return current.tabpage.number
elif expr == 'tabpagenr("$")':