diff options
Diffstat (limited to 'development/eovim/7b320.patch')
-rw-r--r-- | development/eovim/7b320.patch | 182 |
1 files changed, 0 insertions, 182 deletions
diff --git a/development/eovim/7b320.patch b/development/eovim/7b320.patch deleted file mode 100644 index a2b31e8c7f..0000000000 --- a/development/eovim/7b320.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 7b320c17b1fc8821eac411f6d6afc14e32f7e093 Mon Sep 17 00:00:00 2001 -From: Jean Guyomarc'h <jean@guyomarch.bzh> -Date: Sat, 12 Jan 2019 08:46:44 +0100 -Subject: [PATCH] nvim: properly handle the vimenter request - -Fixes #38 ---- - include/eovim/nvim_api.h | 3 ++- - include/eovim/nvim_helper.h | 2 +- - src/nvim.c | 47 +++++++++++++++++++++++++++---------- - src/nvim_api.c | 6 +++-- - src/nvim_helper.c | 4 ++-- - 5 files changed, 43 insertions(+), 19 deletions(-) - -diff --git a/include/eovim/nvim_api.h b/include/eovim/nvim_api.h -index 9885ee1..ca9baab 100644 ---- a/include/eovim/nvim_api.h -+++ b/include/eovim/nvim_api.h -@@ -27,7 +27,8 @@ - #include <Eina.h> - #include <msgpack.h> - --Eina_Bool nvim_api_ui_attach(s_nvim *nvim, unsigned int width, unsigned int height); -+Eina_Bool nvim_api_ui_attach(s_nvim *nvim, unsigned int width, unsigned int height, -+ f_nvim_api_cb func, void *func_data); - Eina_Bool nvim_api_get_api_info(s_nvim *nvim, f_nvim_api_cb cb, void *data); - Eina_Bool nvim_api_ui_try_resize(s_nvim *nvim, unsigned int width, unsigned height); - Eina_Bool nvim_api_ui_ext_cmdline_set(s_nvim *nvim, Eina_Bool externalize); -diff --git a/include/eovim/nvim_helper.h b/include/eovim/nvim_helper.h -index b6ce5f4..9f976d5 100644 ---- a/include/eovim/nvim_helper.h -+++ b/include/eovim/nvim_helper.h -@@ -49,6 +49,6 @@ nvim_helper_highlight_group_decode_noop(s_nvim *nvim, - - - void nvim_helper_autocmd_do(s_nvim *nvim, const char *event); --void nvim_helper_autocmd_vimenter_exec(s_nvim *nvim, f_nvim_api_cb func, void *func_data); -+void nvim_helper_autocmd_vimenter_exec(s_nvim *nvim); - - #endif /* ! __EOVIM_NVIM_HELPER_H__ */ -diff --git a/src/nvim.c b/src/nvim.c -index 83fdee4..a003a00 100644 ---- a/src/nvim.c -+++ b/src/nvim.c -@@ -43,6 +43,8 @@ enum - static Ecore_Event_Handler *_event_handlers[__HANDLERS_LAST]; - static s_nvim *_nvim_instance = NULL; - -+static void _api_decode_cb(s_nvim *nvim, void *data, const msgpack_object *result); -+ - /*============================================================================* - * Private API * - *============================================================================*/ -@@ -278,6 +280,15 @@ _handle_notification(s_nvim *nvim, - return EINA_FALSE; - } - -+static Eina_Bool -+_vimenter_request_cb(s_nvim *nvim EINA_UNUSED, -+ const msgpack_object_array *args EINA_UNUSED, -+ msgpack_packer *pk) -+{ -+ msgpack_pack_nil(pk); /* Error */ -+ msgpack_pack_nil(pk); /* Result */ -+ return EINA_TRUE; -+} - - /*============================================================================* - * Nvim Processes Events Handlers * -@@ -298,6 +309,21 @@ _nvim_added_cb(void *data EINA_UNUSED, - - const Ecore_Exe_Event_Add *const info = event; - INF("Process with PID %i was created", ecore_exe_pid_get(info->exe)); -+ -+ /* Okay, at this point the neovim process is running! Great! Now, we can -+ * start to retrieve the API information and trigger the vimenter autocmd. -+ * -+ * We can start attaching the UI on the fly. -+ * See :help ui-startup for details. -+ */ -+ s_nvim *const nvim = _nvim_get(); -+ nvim_api_get_api_info(nvim, _api_decode_cb, NULL); -+ -+ nvim_helper_autocmd_vimenter_exec(nvim); -+ const s_geometry *const geo = &nvim->opts->geometry; -+ nvim_api_ui_attach(nvim, geo->w, geo->h, _ui_attached_cb, NULL); -+ -+ - return ECORE_CALLBACK_PASS_ON; - } - -@@ -438,6 +464,7 @@ _nvim_received_error_cb(void *data EINA_UNUSED, - return ECORE_CALLBACK_PASS_ON; - } - -+/* FIXME this is soooooo fragile */ - static void - _nvim_runtime_load(s_nvim *nvim, - const char *filename) -@@ -653,16 +680,6 @@ _api_decode_cb(s_nvim *nvim, void *data EINA_UNUSED, const msgpack_object *resul - _virtual_interface_setup(nvim); - } - --static void --_vimenter_cb(s_nvim *nvim, -- void *data EINA_UNUSED, -- const msgpack_object *result EINA_UNUSED) --{ -- _nvim_builtin_runtime_load(nvim); -- _nvim_eovimrc_load(nvim); -- nvim_api_var_integer_set(nvim, "eovim_running", 1); --} -- - static void - _nvim_plugins_load(s_nvim *nvim) - { -@@ -815,6 +832,9 @@ nvim_new(const s_options *opts, - /* Initialize the virtual interface to safe values (non-NULL pointers) */ - _virtual_interface_init(nvim); - -+ /* Add a callback to the vimenter request */ -+ nvim_request_add("vimenter", _vimenter_request_cb); -+ - /* Create the neovim process */ - nvim->exe = ecore_exe_pipe_run( - eina_strbuf_string_get(cmdline), -@@ -831,9 +851,10 @@ nvim_new(const s_options *opts, - DBG("Running %s", eina_strbuf_string_get(cmdline)); - eina_strbuf_free(cmdline); - -- nvim_api_get_api_info(nvim, _api_decode_cb, NULL); -- nvim_helper_autocmd_vimenter_exec(nvim, _vimenter_cb, NULL); -- nvim_api_ui_attach(nvim, opts->geometry.w, opts->geometry.h); -+ /* FIXME These are sooo fragile. Rework that!!! */ -+ _nvim_builtin_runtime_load(nvim); -+ _nvim_eovimrc_load(nvim); -+ nvim_api_var_integer_set(nvim, "eovim_running", 1); - - /* Create the GUI window */ - if (EINA_UNLIKELY(! gui_add(&nvim->gui, nvim))) -diff --git a/src/nvim_api.c b/src/nvim_api.c -index 8082352..cf93577 100644 ---- a/src/nvim_api.c -+++ b/src/nvim_api.c -@@ -138,8 +138,8 @@ void nvim_api_request_call(s_nvim *nvim, - - Eina_Bool - nvim_api_ui_attach(s_nvim *nvim, -- unsigned int width, -- unsigned int height) -+ unsigned int width, unsigned int height, -+ f_nvim_api_cb func, void *func_data) - { - const char api[] = "nvim_ui_attach"; - s_request *const req = _request_new(nvim, api, sizeof(api) - 1); -@@ -148,6 +148,8 @@ nvim_api_ui_attach(s_nvim *nvim, - CRI("Failed to create request"); - return EINA_FALSE; - } -+ req->cb.func = func; -+ req->cb.data = func_data; - - const s_config *const cfg = nvim->config; - -diff --git a/src/nvim_helper.c b/src/nvim_helper.c -index 7199203..2ec09fb 100644 ---- a/src/nvim_helper.c -+++ b/src/nvim_helper.c -@@ -134,11 +134,11 @@ nvim_helper_autocmd_do(s_nvim *nvim, - } - - void --nvim_helper_autocmd_vimenter_exec(s_nvim *nvim, f_nvim_api_cb func, void *func_data) -+nvim_helper_autocmd_vimenter_exec(s_nvim *nvim) - { - const char cmd[] = "autocmd VimEnter * call rpcrequest(1, 'vimenter')"; - const Eina_Bool ok = -- nvim_api_command(nvim, cmd, sizeof(cmd) - 1u, func, func_data); -+ nvim_api_command(nvim, cmd, sizeof(cmd) - 1u, NULL, NULL); - if (EINA_UNLIKELY(! ok)) - { ERR("Failed to execute: %s", cmd); } - } |