diff options
author | Christian Brabandt <cb@256bit.org> | 2024-04-19 15:22:33 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-04-19 15:26:21 +0200 |
commit | 349f5cd8188c85ab0c4083c30de72d5a66604ec7 (patch) | |
tree | 95509433a9da4310047208f2f8dfc6d662e34980 /src/clientserver.c | |
parent | cee034112d41372d4c31abc327c6536b24fc25bd (diff) |
patch 9.1.0356: MS-Windows: --remote may change working directoryv9.1.0356
Problem: MS-Windows: --remote may change working directory when
'shellslash' is set
Solution: normalize directory separators on MS-Windows
fixes: #14549
closes: #14587
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/clientserver.c')
-rw-r--r-- | src/clientserver.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/clientserver.c b/src/clientserver.c index 340add3151..b19cd447fa 100644 --- a/src/clientserver.c +++ b/src/clientserver.c @@ -608,7 +608,7 @@ build_drop_cmd( // Call inputsave() so that a prompt for an encryption key works. ga_concat(&ga, (char_u *) - "<CR>:if exists('*inputsave')|call inputsave()|endif|"); + "<CR><C-\\><C-N>:if exists('*inputsave')|call inputsave()|endif|"); if (tabs) ga_concat(&ga, (char_u *)"tab "); ga_concat(&ga, (char_u *)"drop"); @@ -652,7 +652,13 @@ build_drop_cmd( // endif // endif ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|"); +#ifdef MSWIN + // in case :set shellslash is set, need to normalize the directory separators + // '/' is not valid in a filename so replacing '/' by '\\' should be safe + ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd()->tr('/','\\') ==# '"); +#else ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# '"); +#endif ga_concat(&ga, cdp); ga_concat(&ga, (char_u *)"'|cd -|endif|endif<CR>"); vim_free(cdp); |