0
0
mirror of https://github.com/vim/vim.git synced 2025-11-06 10:07:45 -05:00

updated for version 7.3.996

Problem:    Python: Can't check types of what is returned by bindeval().
Solution:   Add vim.List, vim.Dictionary and vim.Function types. (ZyX)
This commit is contained in:
Bram Moolenaar
2013-05-21 19:50:34 +02:00
parent 1dc28783fa
commit cac867ad18
7 changed files with 90 additions and 12 deletions

View File

@@ -631,10 +631,26 @@ cb.append('Current buffer: ' + repr(vim.current.buffer))
cb.append('Current line: ' + repr(vim.current.line))
for b in vim.buffers:
if b is not cb:
vim.command('bwipeout! ' + b.number)
vim.command('bwipeout! ' + str(b.number))
EOF
:tabonly!
:only!
:"
:" Test types
py << EOF
for expr, attr in (
('vim.vars', 'Dictionary'),
('vim.options', 'Options'),
('vim.bindeval("{}")', 'Dictionary'),
('vim.bindeval("[]")', 'List'),
('vim.bindeval("function(\'tr\')")', 'Function'),
('vim.current.buffer', 'Buffer'),
('vim.current.range', 'Range'),
('vim.current.window', 'Window'),
('vim.current.tabpage', 'TabPage'),
):
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
EOF
:endfun
:"
:call Test()

View File

@@ -333,7 +333,7 @@ Number of tabs: 4
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (954, 0)
<window object (unknown)>(1): displays buffer <buffer test86.in>; cursor is at (970, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
@@ -359,3 +359,12 @@ Current tab page: <tabpage 2>
Current window: <window 0>
Current buffer: <buffer test86.in>
Current line: 'Type error at assigning None to vim.current.buffer'
vim.vars:Dictionary:True
vim.options:Options:True
vim.bindeval("{}"):Dictionary:True
vim.bindeval("[]"):List:True
vim.bindeval("function('tr')"):Function:True
vim.current.buffer:Buffer:True
vim.current.range:Range:True
vim.current.window:Window:True
vim.current.tabpage:TabPage:True

View File

@@ -622,6 +622,22 @@ for b in vim.buffers:
EOF
:tabonly!
:only!
:"
:" Test types
py3 << EOF
for expr, attr in (
('vim.vars', 'Dictionary'),
('vim.options', 'Options'),
('vim.bindeval("{}")', 'Dictionary'),
('vim.bindeval("[]")', 'List'),
('vim.bindeval("function(\'tr\')")', 'Function'),
('vim.current.buffer', 'Buffer'),
('vim.current.range', 'Range'),
('vim.current.window', 'Window'),
('vim.current.tabpage', 'TabPage'),
):
cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr)))
EOF
:endfun
:"
:call Test()

View File

@@ -322,7 +322,7 @@ Number of tabs: 4
Current tab pages:
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (930, 0)
<window object (unknown)>(1): displays buffer <buffer test87.in>; cursor is at (946, 0)
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
Windows:
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
@@ -348,3 +348,12 @@ Current tab page: <tabpage 2>
Current window: <window 0>
Current buffer: <buffer test87.in>
Current line: 'Type error at assigning None to vim.current.buffer'
vim.vars:Dictionary:True
vim.options:Options:True
vim.bindeval("{}"):Dictionary:True
vim.bindeval("[]"):List:True
vim.bindeval("function('tr')"):Function:True
vim.current.buffer:Buffer:True
vim.current.range:Range:True
vim.current.window:Window:True
vim.current.tabpage:TabPage:True