From 4b0e2605eaf90268195029a29f10903dc82729e7 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 9 Feb 2025 22:04:33 +0100 Subject: feat(ui): UI :detach command Problem: Cannot detach the current UI. Solution: - Introduce `:detach`. - Introduce `Channel.detach`. Co-authored-by: bfredl --- src/nvim/ui_client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/nvim/ui_client.c') diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index af946d799a..d42c0a7fdd 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -61,9 +61,14 @@ uint64_t ui_client_start_server(int argc, char **argv) CallbackReader on_err = CALLBACK_READER_INIT; on_err.fwd_err = true; +#ifdef MSWIN + bool detach = false; // TODO(justinmk): detach=true breaks `tt.setup_child_nvim` tests on Windows. +#else + bool detach = true; +#endif Channel *channel = channel_job_start(args, get_vim_var_str(VV_PROGPATH), CALLBACK_READER_INIT, on_err, CALLBACK_NONE, - false, true, true, false, kChannelStdinPipe, + false, true, true, detach, kChannelStdinPipe, NULL, 0, 0, NULL, &exit_status); if (!channel) { return 0; -- cgit From a1906c23ddab6fa4d15bc5ceddee97df8034d8cb Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 10 Feb 2025 11:55:08 +0100 Subject: fix(ui): Windows :detach is opt-in Problem: On Windows, spawning the `nvim --embed` server with `detach=true` breaks various `tt.setup_child_nvim` tests. Solution: Make this behavior opt-in with an env var, temporarily. --- src/nvim/ui_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/ui_client.c') diff --git a/src/nvim/ui_client.c b/src/nvim/ui_client.c index d42c0a7fdd..44fc645a04 100644 --- a/src/nvim/ui_client.c +++ b/src/nvim/ui_client.c @@ -62,7 +62,8 @@ uint64_t ui_client_start_server(int argc, char **argv) on_err.fwd_err = true; #ifdef MSWIN - bool detach = false; // TODO(justinmk): detach=true breaks `tt.setup_child_nvim` tests on Windows. + // TODO(justinmk): detach breaks `tt.setup_child_nvim` tests on Windows? + bool detach = os_env_exists("__NVIM_DETACH"); #else bool detach = true; #endif -- cgit