aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-03-16 22:18:14 +0100
committerbfredl <bjorn.linse@gmail.com>2022-03-17 19:39:06 +0100
commit55b6ade7fee36283dc2853494edf9a5ac2dd4be9 (patch)
treefece1fccb179cae8b59c2141c8b8e4797d532ada
parentc6640d0d700f977913606277418be546404d5fd7 (diff)
downloadrneovim-55b6ade7fee36283dc2853494edf9a5ac2dd4be9.tar.gz
rneovim-55b6ade7fee36283dc2853494edf9a5ac2dd4be9.tar.bz2
rneovim-55b6ade7fee36283dc2853494edf9a5ac2dd4be9.zip
feat(ui_client): implement async paste handling
-rw-r--r--src/nvim/tui/input.c12
-rw-r--r--src/nvim/ui_client.c2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index faae921a68..917847608a 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -126,8 +126,16 @@ static void tinput_wait_enqueue(void **argv)
const String keys = { .data = buf, .size = len };
if (input->paste) {
String copy = copy_string(keys);
- multiqueue_put(main_loop.events, tinput_paste_event, 3,
- copy.data, copy.size, (intptr_t)input->paste);
+ if (ui_client_channel_id) {
+ Array args = ARRAY_DICT_INIT;
+ ADD(args, STRING_OBJ(copy_string(keys))); // 'data'
+ ADD(args, BOOLEAN_OBJ(true)); // 'crlf'
+ ADD(args, INTEGER_OBJ(input->paste)); // 'phase'
+ rpc_send_event(ui_client_channel_id, "nvim_paste", args);
+ } else {
+ multiqueue_put(main_loop.events, tinput_paste_event, 3,
+ copy.data, copy.size, (intptr_t)input->paste);
+ }
if (input->paste == 1) {
// Paste phase: "continue"
input->paste = 2;
diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c
index aa33f2fc73..6e45a28e89 100644
--- a/src/nvim/ui_client.c
+++ b/src/nvim/ui_client.c
@@ -52,8 +52,6 @@ void ui_client_init(uint64_t chan)
/// Handler for "redraw" events sent by the NVIM server
///
-/// This is just a stub. The mentioned functionality will be implemented.
-///
/// This function will be called by handle_request (in msgpack_rpc/channel.c)
/// The individual ui_events sent by the server are individually handled
/// by their respective handlers defined in ui_events_client.generated.h