aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/aucmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-11 18:44:20 -0700
committerJustin M. Keyes <justinkz@gmail.com>2019-09-12 17:04:05 -0700
commit6dd56d09025c960ef36952e3d4a1f77779782c52 (patch)
tree4619033c696a2ea5442e85a1f570ebf223541f86 /src/nvim/aucmd.c
parente9cf515888705640ebd754483349f2bf84c32255 (diff)
downloadrneovim-6dd56d09025c960ef36952e3d4a1f77779782c52.tar.gz
rneovim-6dd56d09025c960ef36952e3d4a1f77779782c52.tar.bz2
rneovim-6dd56d09025c960ef36952e3d4a1f77779782c52.zip
UIAttach, UIDetach
doc: ginit.vim, gvimrc fix #3656
Diffstat (limited to 'src/nvim/aucmd.c')
-rw-r--r--src/nvim/aucmd.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/nvim/aucmd.c b/src/nvim/aucmd.c
index 3bb0fcec3b..5188f96a5d 100644
--- a/src/nvim/aucmd.c
+++ b/src/nvim/aucmd.c
@@ -7,11 +7,32 @@
#include "nvim/main.h"
#include "nvim/ui.h"
#include "nvim/aucmd.h"
+#include "nvim/eval.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "aucmd.c.generated.h"
#endif
+void do_autocmd_uiattach(uint64_t chanid, bool attached)
+{
+ static bool recursive = false;
+
+ if (recursive) {
+ return; // disallow recursion
+ }
+ recursive = true;
+
+ dict_T *dict = get_vim_var_dict(VV_EVENT);
+ assert(chanid < VARNUMBER_MAX);
+ tv_dict_add_nr(dict, S_LEN("chan"), (varnumber_T)chanid);
+ tv_dict_set_keys_readonly(dict);
+ apply_autocmds(attached ? EVENT_UIATTACH : EVENT_UIDETACH,
+ NULL, NULL, false, curbuf);
+ tv_dict_clear(dict);
+
+ recursive = false;
+}
+
static void focusgained_event(void **argv)
{
bool *gainedp = argv[0];
@@ -38,4 +59,3 @@ static void do_autocmd_focusgained(bool gained)
NULL, NULL, false, curbuf);
recursive = false;
}
-