summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-03-24 16:48:58 +0100
committerBram Moolenaar <Bram@vim.org>2015-03-24 16:48:58 +0100
commitf11ce667b06ffb7447fb55638a04b5fa5cfe29a0 (patch)
treef54680e8fede840df63a7d50769283e7948f5317
parenta161e26d558204311f6e76208fa4cd3b2dbbab0b (diff)
updated for version 7.4.678v7.4.678
Problem: When using --remote the directory may end up being wrong. Solution: Use localdir() to find out what to do. (Xaizek)
-rw-r--r--src/main.c25
-rw-r--r--src/version.c2
2 files changed, 21 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 885192bedd..50f6f6043c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3914,6 +3914,7 @@ build_drop_cmd(filec, filev, tabs, sendReply)
int i;
char_u *inicmd = NULL;
char_u *p;
+ char_u *cdp;
char_u *cwd;
if (filec > 0 && filev[0][0] == '+')
@@ -3935,7 +3936,7 @@ build_drop_cmd(filec, filev, tabs, sendReply)
vim_free(cwd);
return NULL;
}
- p = vim_strsave_escaped_ext(cwd,
+ cdp = vim_strsave_escaped_ext(cwd,
#ifdef BACKSLASH_IN_FILENAME
"", /* rem_backslash() will tell what chars to escape */
#else
@@ -3943,12 +3944,11 @@ build_drop_cmd(filec, filev, tabs, sendReply)
#endif
'\\', TRUE);
vim_free(cwd);
- if (p == NULL)
+ if (cdp == NULL)
return NULL;
ga_init2(&ga, 1, 100);
ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");
- ga_concat(&ga, p);
- vim_free(p);
+ ga_concat(&ga, cdp);
/* Call inputsave() so that a prompt for an encryption key works. */
ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call inputsave()|endif|");
@@ -3984,8 +3984,21 @@ build_drop_cmd(filec, filev, tabs, sendReply)
/* Switch back to the correct current directory (prior to temporary path
* switch) unless 'autochdir' is set, in which case it will already be
- * correct after the :drop command. */
- ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|cd -|endif<CR>");
+ * correct after the :drop command. With line breaks and spaces:
+ * if !exists('+acd') || !&acd
+ * if haslocaldir()
+ * cd -
+ * lcd -
+ * elseif getcwd() ==# "current path"
+ * cd -
+ * endif
+ * endif
+ */
+ ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|");
+ ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# \"");
+ ga_concat(&ga, cdp);
+ ga_concat(&ga, (char_u *)"\"|cd -|endif|endif<CR>");
+ vim_free(cdp);
if (sendReply)
ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>");
diff --git a/src/version.c b/src/version.c
index 086b6fdebb..ddd8e04531 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 678,
+/**/
677,
/**/
676,