Skip to content

Commit

Permalink
feat(ui_client): implement async paste handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bfredl committed Mar 17, 2022
1 parent c6640d0 commit 55b6ade
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/nvim/tui/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/nvim/ui_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55b6ade

Please sign in to comment.