aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui_bridge.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/ui_bridge.c
parent426399c2c4dd325bf00ffe1f410c1b9fd5053692 (diff)
downloadrneovim-e9cf515888705640ebd754483349f2bf84c32255.tar.gz
rneovim-e9cf515888705640ebd754483349f2bf84c32255.tar.bz2
rneovim-e9cf515888705640ebd754483349f2bf84c32255.zip
UIAttach, UIDetach
Diffstat (limited to 'src/nvim/ui_bridge.c')
-rw-r--r--src/nvim/ui_bridge.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c
index 91cd458702..be76a8b047 100644
--- a/src/nvim/ui_bridge.c
+++ b/src/nvim/ui_bridge.c
@@ -17,6 +17,8 @@
#include "nvim/ui_bridge.h"
#include "nvim/ugrid.h"
#include "nvim/api/private/helpers.h"
+#include "nvim/fileio.h"
+#include "nvim/eval.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui_bridge.c.generated.h"
@@ -86,6 +88,13 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler)
uv_mutex_unlock(&rv->mutex);
ui_attach_impl(&rv->bridge);
+
+ dict_T *dict = get_vim_var_dict(VV_EVENT);
+ tv_dict_add_nr(dict, S_LEN("chan"), 0);
+ tv_dict_set_keys_readonly(dict);
+ apply_autocmds(EVENT_UIATTACH, NULL, NULL, false, curbuf);
+ tv_dict_clear(dict);
+
return &rv->bridge;
}
@@ -107,6 +116,13 @@ static void ui_bridge_stop(UI *b)
// Detach bridge first, so that "stop" is the last event the TUI loop
// receives from the main thread. #8041
ui_detach_impl(b);
+
+ dict_T *dict = get_vim_var_dict(VV_EVENT);
+ tv_dict_add_nr(dict, S_LEN("chan"), 0);
+ tv_dict_set_keys_readonly(dict);
+ apply_autocmds(EVENT_UIDETACH, NULL, NULL, false, curbuf);
+ tv_dict_clear(dict);
+
UIBridgeData *bridge = (UIBridgeData *)b;
bool stopped = bridge->stopped = false;
UI_BRIDGE_CALL(b, stop, 1, b);