mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 03:16:31 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user