mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
API: Implement tabpage_get_window
This commit is contained in:
parent
e026be46af
commit
14f2a3d533
@ -3,6 +3,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "api/tabpage.h"
|
#include "api/tabpage.h"
|
||||||
|
#include "api/vim.h"
|
||||||
#include "api/defs.h"
|
#include "api/defs.h"
|
||||||
#include "api/helpers.h"
|
#include "api/helpers.h"
|
||||||
|
|
||||||
@ -36,9 +37,31 @@ Object tabpage_set_var(Tabpage tabpage, String name, Object value, Error *err)
|
|||||||
return dict_set_value(tab->tp_vars, name, value, err);
|
return dict_set_value(tab->tp_vars, name, value, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
Window tabpage_get_buffer(Tabpage tabpage, Error *err)
|
Window tabpage_get_window(Tabpage tabpage, Error *err)
|
||||||
{
|
{
|
||||||
abort();
|
Window rv = 0;
|
||||||
|
tabpage_T *tab = find_tab(tabpage, err);
|
||||||
|
|
||||||
|
if (!tab) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tab == curtab) {
|
||||||
|
return vim_get_current_window();
|
||||||
|
} else {
|
||||||
|
tabpage_T *tp;
|
||||||
|
win_T *wp;
|
||||||
|
rv = 1;
|
||||||
|
|
||||||
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||||
|
if (tp == tab && wp == tab->tp_curwin) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
rv++;
|
||||||
|
}
|
||||||
|
// There should always be a current window for a tabpage
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tabpage_is_valid(Tabpage tabpage)
|
bool tabpage_is_valid(Tabpage tabpage)
|
||||||
|
@ -35,7 +35,7 @@ Object tabpage_set_var(Tabpage tabpage, String name, Object value, Error *err);
|
|||||||
/// @param tabpage The tab page handle
|
/// @param tabpage The tab page handle
|
||||||
/// @param[out] err Details of an error that may have occurred
|
/// @param[out] err Details of an error that may have occurred
|
||||||
/// @return The Window handle
|
/// @return The Window handle
|
||||||
Window tabpage_get_buffer(Tabpage tabpage, Error *err);
|
Window tabpage_get_window(Tabpage tabpage, Error *err);
|
||||||
|
|
||||||
/// Checks if a tab page is valid
|
/// Checks if a tab page is valid
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user