diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-11-16 16:25:51 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-11-16 16:25:51 +0100 |
commit | 00b78c17b24e61b73f8ecf8fa3e5154d396c1d1a (patch) | |
tree | e4aa948500ad0b094842cedaf9318153a833535a /src/main.c | |
parent | 7ad7d01074c41802ccce8412f532ac99c7c1a045 (diff) | |
download | vim-git-00b78c17b24e61b73f8ecf8fa3e5154d396c1d1a.tar.gz |
updated for version 7.3.061v7.3.061
Problem: Remote ":drop" does not respect 'autochdir'. (Peter Odding)
Solution: Don't restore the directory when 'autochdir' is set. (Benjamin
Fritz)
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c index cc99d1fe5..faf574a9b 100644 --- a/src/main.c +++ b/src/main.c @@ -3817,6 +3817,8 @@ build_drop_cmd(filec, filev, tabs, sendReply) /* Check if we have at least one argument. */ if (filec <= 0) mainerr_arg_missing((char_u *)filev[-1]); + + /* Temporarily cd to the current directory to handle relative file names. */ if (mch_dirname(cwd, MAXPATHL) != OK) return NULL; if ((p = vim_strsave_escaped_ext(cwd, @@ -3858,13 +3860,20 @@ build_drop_cmd(filec, filev, tabs, sendReply) ga_concat(&ga, p); vim_free(p); } + ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>"); + /* The :drop commands goes to Insert mode when 'insertmode' is set, use * CTRL-\ CTRL-N again. */ - ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>"); - ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd -"); + ga_concat(&ga, (char_u *)"<C-\\><C-N>"); + + /* 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>"); + if (sendReply) - ga_concat(&ga, (char_u *)"<CR>:call SetupRemoteReplies()"); - ga_concat(&ga, (char_u *)"<CR>:"); + ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>"); + ga_concat(&ga, (char_u *)":"); if (inicmd != NULL) { /* Can't use <CR> after "inicmd", because an "startinsert" would cause |