diff options
author | James McCoy <jamessan@jamessan.com> | 2016-10-15 15:29:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-15 15:29:53 -0400 |
commit | b268ba353af42d2a2f32e04a17b6acd92f06d31c (patch) | |
tree | d7041ccd96b4b72a99124e486558c97ec2555202 /src/nvim/api/tabpage.c | |
parent | 885db120fa51ea5209ed97a4096b756dc998cf05 (diff) | |
parent | 1ebb75b1ec5b22d7c7dba1c7fdc9e7969b81ad4d (diff) | |
download | rneovim-b268ba353af42d2a2f32e04a17b6acd92f06d31c.tar.gz rneovim-b268ba353af42d2a2f32e04a17b6acd92f06d31c.tar.bz2 rneovim-b268ba353af42d2a2f32e04a17b6acd92f06d31c.zip |
Merge pull request #5424 from jamessan/win-tab-nr
api: Support getting the number of a window/tabpage
Diffstat (limited to 'src/nvim/api/tabpage.c')
-rw-r--r-- | src/nvim/api/tabpage.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index 8b1fb041e2..fa00988ae3 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -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 |