From 07a105f0cb6e2827e621ea31c52cd7714a44a418 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 26 Jan 2020 02:13:37 -0800 Subject: terminal: trim CWD slash #11762 Trailing CWD slash in term:// buffer name breaks the BufReadCmd handler. Before: term://~///25232:/bin/bash After: term://~//25232:/bin/bash ref c6ff23d7a0d5 ref #11289 --- src/nvim/eval.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ce1d55afab..55b18d5f4f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -18386,7 +18386,12 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr) // "./…" => "/home/foo/…" vim_FullName(cwd, (char *)NameBuff, sizeof(NameBuff), false); // "/home/foo/…" => "~/…" - home_replace(NULL, NameBuff, IObuff, sizeof(IObuff), true); + size_t len = home_replace(NULL, NameBuff, IObuff, sizeof(IObuff), true); + // Trim slash. + if (IObuff[len - 1] == '\\' || IObuff[len - 1] == '/') { + IObuff[len - 1] = '\0'; + } + // Terminal URI: "term://$CWD//$PID:$CMD" snprintf((char *)NameBuff, sizeof(NameBuff), "term://%s//%d:%s", (char *)IObuff, pid, cmd); -- cgit