diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-09-22 10:20:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-22 10:20:23 +0200 |
commit | c236e80cf3dfae6df5c43ecfb19c7629c9884f7b (patch) | |
tree | 426eb0f7525621d9760bb2cbf394d5c42b691775 /src/nvim/api/ui.c | |
parent | 7f990741f7018b5e52833f2da6913b97c6d2d5ee (diff) | |
parent | 4da5cb38d396d76d8072815d150725f7c9a85078 (diff) | |
download | rneovim-c236e80cf3dfae6df5c43ecfb19c7629c9884f7b.tar.gz rneovim-c236e80cf3dfae6df5c43ecfb19c7629c9884f7b.tar.bz2 rneovim-c236e80cf3dfae6df5c43ecfb19c7629c9884f7b.zip |
Merge pull request #9024 from bfredl/embed_ui2
always wait for UI with --embed, unless --headless is supplied
Diffstat (limited to 'src/nvim/api/ui.c')
-rw-r--r-- | src/nvim/api/ui.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 509032892b..4971753854 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -58,6 +58,21 @@ void remote_ui_disconnect(uint64_t channel_id) xfree(ui); } +/// Wait until ui has connected on stdio channel. +void remote_ui_wait_for_attach(void) + FUNC_API_NOEXPORT +{ + Channel *channel = find_channel(CHAN_STDIO); + if (!channel) { + // this function should only be called in --embed mode, stdio channel + // can be assumed. + abort(); + } + + LOOP_PROCESS_EVENTS_UNTIL(&main_loop, channel->events, -1, + pmap_has(uint64_t)(connected_uis, CHAN_STDIO)); +} + void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, Dictionary options, Error *err) FUNC_API_SINCE(1) FUNC_API_REMOTE_ONLY |