mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +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:
@@ -159,6 +159,23 @@ Window nvim_tabpage_get_win(Tabpage tabpage, Error *err)
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the tab page number
|
||||
///
|
||||
/// @param tabpage The tabpage handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The tabpage number
|
||||
Integer nvim_tabpage_get_number(Tabpage tabpage, Error *err)
|
||||
{
|
||||
Integer rv = 0;
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
|
||||
if (!tab) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return tabpage_index(tab);
|
||||
}
|
||||
|
||||
/// Checks if a tab page is valid
|
||||
///
|
||||
/// @param tabpage The tab page handle
|
||||
|
Reference in New Issue
Block a user