aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/main.c5
-rw-r--r--test/functional/core/startup_spec.lua13
2 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 377b804661..d9ca82784f 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -921,6 +921,11 @@ static void remote_request(mparm_T *params, int remote_args, char *server_addr,
os_errmsg(connect_error);
os_errmsg("\n");
os_exit(1);
+ } else if (strequal(server_addr, os_getenv("NVIM"))) {
+ os_errmsg("Cannot attach UI of :terminal child to its parent. ");
+ os_errmsg("(Unset $NVIM to skip this check)");
+ os_errmsg("\n");
+ os_exit(1);
}
ui_client_channel_id = chan;
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index fb30ddebb9..94ec3d4907 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -41,6 +41,19 @@ describe('startup', function()
ok(string.find(alter_slashes(meths.get_option_value('runtimepath', {})), funcs.stdpath('config'), 1, true) == nil)
end)
+ it('prevents remote UI infinite loop', function()
+ clear()
+ local screen
+ screen = Screen.new(84, 3)
+ screen:attach()
+ funcs.termopen({ nvim_prog, '-u', 'NONE', '--server', eval('v:servername'), '--remote-ui' })
+ screen:expect([[
+ ^Cannot attach UI of :terminal child to its parent. (Unset $NVIM to skip this check) |
+ |
+ |
+ ]])
+ end)
+
it('--startuptime', function()
local testfile = 'Xtest_startuptime'
finally(function()