diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/nvim/api/ui.c | 26 | ||||
-rw-r--r-- | src/nvim/autocmd.c | 3 | ||||
-rw-r--r-- | src/nvim/main.c | 5 | ||||
-rw-r--r-- | src/nvim/ui.c | 10 |
5 files changed, 34 insertions, 18 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 9cad80db23..49402a36a8 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -100,7 +100,8 @@ else() -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute - -Wmissing-prototypes) + -Wmissing-prototypes + -fsigned-char) if(CMAKE_C_COMPILER_ID STREQUAL "GNU") target_compile_options(main_lib INTERFACE -fno-common @@ -172,11 +173,6 @@ if(CI_BUILD) endif() endif() -option(UNSIGNED_CHAR "Set char to be unsigned" OFF) -if(UNSIGNED_CHAR) - target_compile_options(main_lib INTERFACE -funsigned-char) -endif() - target_compile_definitions(main_lib INTERFACE INCLUDE_GENERATED_DECLARATIONS) # Remove --sort-common from linker flags, as this seems to cause bugs (see #2641, #3374). diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index e0b5e6ea57..b508a3ee94 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -126,18 +126,24 @@ 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) +/// Wait until ui has connected on stdio channel if only_stdio +/// is true, otherwise any channel. +void remote_ui_wait_for_attach(bool only_stdio) { - Channel *channel = find_channel(CHAN_STDIO); - if (!channel) { - // this function should only be called in --embed mode, stdio channel - // can be assumed. - abort(); - } + if (only_stdio) { + 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, - map_has(uint64_t, &connected_uis, CHAN_STDIO)); + LOOP_PROCESS_EVENTS_UNTIL(&main_loop, channel->events, -1, + map_has(uint64_t, &connected_uis, CHAN_STDIO)); + } else { + LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, -1, + ui_active()); + } } /// Activates UI events on the channel. diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 2537269c5c..bdb3983ab3 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -2570,6 +2570,9 @@ void do_autocmd_uienter(uint64_t chanid, bool attached) { static bool recursive = false; + if (starting == NO_SCREEN) { + return; // user config hasn't been sourced yet + } if (recursive) { return; // disallow recursion } diff --git a/src/nvim/main.c b/src/nvim/main.c index f6fd3abaec..88d198bfa5 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -392,9 +392,10 @@ int main(int argc, char **argv) // Wait for UIs to set up Nvim or show early messages // and prompts (--cmd, swapfile dialog, …). bool use_remote_ui = (embedded_mode && !headless_mode); + bool listen_and_embed = params.listen_addr != NULL; if (use_remote_ui) { TIME_MSG("waiting for UI"); - remote_ui_wait_for_attach(); + remote_ui_wait_for_attach(!listen_and_embed); TIME_MSG("done waiting for UI"); firstwin->w_prev_height = firstwin->w_height; // may have changed } @@ -588,7 +589,7 @@ int main(int argc, char **argv) apply_autocmds(EVENT_VIMENTER, NULL, NULL, false, curbuf); TIME_MSG("VimEnter autocommands"); if (use_remote_ui) { - do_autocmd_uienter(CHAN_STDIO, true); + do_autocmd_uienter_all(); TIME_MSG("UIEnter autocommands"); } diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 954d933d9c..90d475e7e7 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -337,6 +337,16 @@ void vim_beep(unsigned val) } } +/// Trigger UIEnter for all attached UIs. +/// Used on startup after VimEnter. +void do_autocmd_uienter_all(void) +{ + for (size_t i = 0; i < ui_count; i++) { + UIData *data = uis[i]->data; + do_autocmd_uienter(data->channel_id, true); + } +} + void ui_attach_impl(UI *ui, uint64_t chanid) { if (ui_count == MAX_UI_COUNT) { |