aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/ui.c
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2017-06-21 16:59:52 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-09-12 15:52:54 -0700
commite9cf515888705640ebd754483349f2bf84c32255 (patch)
treea8709dfdb9e5e6090b47fc601e6bc21350f78fac /src/nvim/api/ui.c
parent426399c2c4dd325bf00ffe1f410c1b9fd5053692 (diff)
downloadrneovim-e9cf515888705640ebd754483349f2bf84c32255.tar.gz
rneovim-e9cf515888705640ebd754483349f2bf84c32255.tar.bz2
rneovim-e9cf515888705640ebd754483349f2bf84c32255.zip
UIAttach, UIDetach
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r--src/nvim/api/ui.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index ada26a2a07..acf0404c31 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -19,6 +19,8 @@
#include "nvim/highlight.h"
#include "nvim/screen.h"
#include "nvim/window.h"
+#include "nvim/fileio.h"
+#include "nvim/eval.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/ui.c.generated.h"
@@ -169,6 +171,12 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
pmap_put(uint64_t)(connected_uis, channel_id, ui);
ui_attach_impl(ui);
+
+ dict_T *dict = get_vim_var_dict(VV_EVENT);
+ tv_dict_add_nr(dict, S_LEN("chan"), (long)channel_id);
+ tv_dict_set_keys_readonly(dict);
+ apply_autocmds(EVENT_UIATTACH, NULL, NULL, false, curbuf);
+ tv_dict_clear(dict);
}
/// @deprecated
@@ -196,6 +204,12 @@ void nvim_ui_detach(uint64_t channel_id, Error *err)
return;
}
remote_ui_disconnect(channel_id);
+
+ dict_T *dict = get_vim_var_dict(VV_EVENT);
+ tv_dict_add_nr(dict, S_LEN("chan"), (long)channel_id);
+ tv_dict_set_keys_readonly(dict);
+ apply_autocmds(EVENT_UIDETACH, NULL, NULL, false, curbuf);
+ tv_dict_clear(dict);
}