diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-12-08 22:31:35 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-12-08 23:44:24 -0300 |
commit | f8c3a14dc32cd27df7f9772ab59690e56626d807 (patch) | |
tree | 38ea9ffcab773394c15814dde8af261bca7a19ba /src/nvim/msgpack_rpc/channel.c | |
parent | 86542c6fd0677a712c6b87049a04d8e67cda3e3d (diff) | |
download | rneovim-f8c3a14dc32cd27df7f9772ab59690e56626d807.tar.gz rneovim-f8c3a14dc32cd27df7f9772ab59690e56626d807.tar.bz2 rneovim-f8c3a14dc32cd27df7f9772ab59690e56626d807.zip |
msgpack-rpc: Add remote_ui module
The remote_ui module is an implementation of the UI layer, and it attaches UI
instances that redirect redraw notifications to connected clients.
Diffstat (limited to 'src/nvim/msgpack_rpc/channel.c')
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index b6ac3fab82..4c35cce09a 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -10,6 +10,7 @@ #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" #include "nvim/msgpack_rpc/channel.h" +#include "nvim/msgpack_rpc/remote_ui.h" #include "nvim/os/event.h" #include "nvim/os/rstream.h" #include "nvim/os/rstream_defs.h" @@ -100,6 +101,17 @@ void channel_init(void) if (embedded_mode) { channel_from_stdio(); } + + if (abstract_ui) { + // Add handler for "attach_ui" + remote_ui_init(); + String method = cstr_as_string("attach_ui"); + MsgpackRpcRequestHandler handler = {.fn = remote_ui_attach, .defer = true}; + msgpack_rpc_add_method_handler(method, handler); + method = cstr_as_string("detach_ui"); + handler.fn = remote_ui_detach; + msgpack_rpc_add_method_handler(method, handler); + } } /// Teardown the module @@ -645,6 +657,10 @@ static void on_stdio_close(Event e) static void free_channel(Channel *channel) { + if (abstract_ui) { + remote_ui_disconnect(channel->id); + } + pmap_del(uint64_t)(channels, channel->id); msgpack_unpacker_free(channel->unpacker); |