UIAttach, UIDetach

doc: ginit.vim, gvimrc
fix #3656
This commit is contained in:
Justin M. Keyes
2019-09-11 18:44:20 -07:00
parent e9cf515888
commit 6dd56d0902
14 changed files with 85 additions and 121 deletions

View File

@@ -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;
}