diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-05-23 15:49:35 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-05-23 16:06:58 -0300 |
commit | 5fdf854f78eb1a87acb2d28b3d941d988bd1b74e (patch) | |
tree | 8210d30edfa8a0660ad38a7627c8b7555969ed3d /src | |
parent | 20848c4064fc82c160d68770b2e64f5115f0bf60 (diff) | |
download | rneovim-5fdf854f78eb1a87acb2d28b3d941d988bd1b74e.tar.gz rneovim-5fdf854f78eb1a87acb2d28b3d941d988bd1b74e.tar.bz2 rneovim-5fdf854f78eb1a87acb2d28b3d941d988bd1b74e.zip |
API: Refactor: Register/unregister created/destroyed tabpages
- Add the 'handle' field to `tabpage_T`
- Add declare/implement functions for registering/unregistering/retrieving
tabpages
- Register/unregister tabpages when they are created/destroyed.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/private/handle.c | 2 | ||||
-rw-r--r-- | src/nvim/api/private/handle.h | 1 | ||||
-rw-r--r-- | src/nvim/buffer_defs.h | 1 | ||||
-rw-r--r-- | src/nvim/window.c | 2 |
4 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c index 3dfe05d59f..88d176fccb 100644 --- a/src/nvim/api/private/handle.c +++ b/src/nvim/api/private/handle.c @@ -30,9 +30,11 @@ static uint64_t next_handle = 1; HANDLE_IMPL(buf_T, buffer) HANDLE_IMPL(win_T, window) +HANDLE_IMPL(tabpage_T, tabpage) void handle_init() { HANDLE_INIT(buffer); HANDLE_INIT(window); + HANDLE_INIT(tabpage); } diff --git a/src/nvim/api/private/handle.h b/src/nvim/api/private/handle.h index 29c80e10d4..27df453233 100644 --- a/src/nvim/api/private/handle.h +++ b/src/nvim/api/private/handle.h @@ -11,6 +11,7 @@ HANDLE_DECLS(buf_T, buffer) HANDLE_DECLS(win_T, window) +HANDLE_DECLS(tabpage_T, tabpage) void handle_init(void); diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 68f70d7bf3..0a24280b4a 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -738,6 +738,7 @@ struct diffblock_S { */ typedef struct tabpage_S tabpage_T; struct tabpage_S { + uint64_t handle; tabpage_T *tp_next; /* next tabpage or NULL */ frame_T *tp_topframe; /* topframe for the windows */ win_T *tp_curwin; /* current window in this Tab page */ diff --git a/src/nvim/window.c b/src/nvim/window.c index a0a325f950..534805b766 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2845,6 +2845,7 @@ void win_init_size(void) static tabpage_T *alloc_tabpage(void) { tabpage_T *tp = xcalloc(1, sizeof(tabpage_T)); + handle_register_tabpage(tp); /* init t: variables */ tp->tp_vars = dict_alloc(); @@ -2859,6 +2860,7 @@ void free_tabpage(tabpage_T *tp) { int idx; + handle_unregister_tabpage(tp); diff_clear(tp); for (idx = 0; idx < SNAP_COUNT; ++idx) clear_snapshot(tp, idx); |