diff options
author | James McCoy <jamessan@jamessan.com> | 2016-10-03 23:36:47 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2016-10-04 14:34:35 -0400 |
commit | 1ebb75b1ec5b22d7c7dba1c7fdc9e7969b81ad4d (patch) | |
tree | 9b2202052b77173d73efcdd7b34a273f25ff5caa /test/functional/api/tabpage_spec.lua | |
parent | b1edc8abb7e0f11064fde9d4b208fb06f0c16a35 (diff) | |
download | rneovim-1ebb75b1ec5b22d7c7dba1c7fdc9e7969b81ad4d.tar.gz rneovim-1ebb75b1ec5b22d7c7dba1c7fdc9e7969b81ad4d.tar.bz2 rneovim-1ebb75b1ec5b22d7c7dba1c7fdc9e7969b81ad4d.zip |
api: Support getting the number of a window/tabpage
In order to provide better compatibility with the classic bindings, the
API needs to provide the ability to query the number (really index) of
the window/tabpage.
This is needed for neovim/python-client#87, as discussed in
neovim/neovim#1898.
Signed-off-by: James McCoy <jamessan@jamessan.com>
Diffstat (limited to 'test/functional/api/tabpage_spec.lua')
-rw-r--r-- | test/functional/api/tabpage_spec.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua index 47dede8b44..90940e9577 100644 --- a/test/functional/api/tabpage_spec.lua +++ b/test/functional/api/tabpage_spec.lua @@ -51,6 +51,22 @@ describe('tabpage_* functions', function() end) end) + describe('get_number', function() + it('works', function() + local tabs = nvim('list_tabpages') + eq(1, tabpage('get_number', tabs[1])) + + nvim('command', 'tabnew') + local tab1, tab2 = unpack(nvim('list_tabpages')) + eq(1, tabpage('get_number', tab1)) + eq(2, tabpage('get_number', tab2)) + + nvim('command', '-tabmove') + eq(2, tabpage('get_number', tab1)) + eq(1, tabpage('get_number', tab2)) + end) + end) + describe('is_valid', function() it('works', function() nvim('command', 'tabnew') |