mirror of
https://github.com/neovim/neovim.git
synced 2025-11-19 16:51:18 +00:00
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>
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user