comparison src/main.c @ 6708:b225e8fed8cc v7.4.678

updated for version 7.4.678 Problem: When using --remote the directory may end up being wrong. Solution: Use localdir() to find out what to do. (Xaizek)
author Bram Moolenaar <bram@vim.org>
date Tue, 24 Mar 2015 16:48:58 +0100
parents 6eecaf5a18ca
children 7d40186f767a
comparison
equal deleted inserted replaced
6707:fff77fccc858 6708:b225e8fed8cc
3912 { 3912 {
3913 garray_T ga; 3913 garray_T ga;
3914 int i; 3914 int i;
3915 char_u *inicmd = NULL; 3915 char_u *inicmd = NULL;
3916 char_u *p; 3916 char_u *p;
3917 char_u *cdp;
3917 char_u *cwd; 3918 char_u *cwd;
3918 3919
3919 if (filec > 0 && filev[0][0] == '+') 3920 if (filec > 0 && filev[0][0] == '+')
3920 { 3921 {
3921 inicmd = (char_u *)filev[0] + 1; 3922 inicmd = (char_u *)filev[0] + 1;
3933 if (mch_dirname(cwd, MAXPATHL) != OK) 3934 if (mch_dirname(cwd, MAXPATHL) != OK)
3934 { 3935 {
3935 vim_free(cwd); 3936 vim_free(cwd);
3936 return NULL; 3937 return NULL;
3937 } 3938 }
3938 p = vim_strsave_escaped_ext(cwd, 3939 cdp = vim_strsave_escaped_ext(cwd,
3939 #ifdef BACKSLASH_IN_FILENAME 3940 #ifdef BACKSLASH_IN_FILENAME
3940 "", /* rem_backslash() will tell what chars to escape */ 3941 "", /* rem_backslash() will tell what chars to escape */
3941 #else 3942 #else
3942 PATH_ESC_CHARS, 3943 PATH_ESC_CHARS,
3943 #endif 3944 #endif
3944 '\\', TRUE); 3945 '\\', TRUE);
3945 vim_free(cwd); 3946 vim_free(cwd);
3946 if (p == NULL) 3947 if (cdp == NULL)
3947 return NULL; 3948 return NULL;
3948 ga_init2(&ga, 1, 100); 3949 ga_init2(&ga, 1, 100);
3949 ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd "); 3950 ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");
3950 ga_concat(&ga, p); 3951 ga_concat(&ga, cdp);
3951 vim_free(p);
3952 3952
3953 /* Call inputsave() so that a prompt for an encryption key works. */ 3953 /* Call inputsave() so that a prompt for an encryption key works. */
3954 ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call inputsave()|endif|"); 3954 ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call inputsave()|endif|");
3955 if (tabs) 3955 if (tabs)
3956 ga_concat(&ga, (char_u *)"tab "); 3956 ga_concat(&ga, (char_u *)"tab ");
3982 * CTRL-\ CTRL-N again. */ 3982 * CTRL-\ CTRL-N again. */
3983 ga_concat(&ga, (char_u *)"<C-\\><C-N>"); 3983 ga_concat(&ga, (char_u *)"<C-\\><C-N>");
3984 3984
3985 /* Switch back to the correct current directory (prior to temporary path 3985 /* Switch back to the correct current directory (prior to temporary path
3986 * switch) unless 'autochdir' is set, in which case it will already be 3986 * switch) unless 'autochdir' is set, in which case it will already be
3987 * correct after the :drop command. */ 3987 * correct after the :drop command. With line breaks and spaces:
3988 ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|cd -|endif<CR>"); 3988 * if !exists('+acd') || !&acd
3989 * if haslocaldir()
3990 * cd -
3991 * lcd -
3992 * elseif getcwd() ==# "current path"
3993 * cd -
3994 * endif
3995 * endif
3996 */
3997 ga_concat(&ga, (char_u *)":if !exists('+acd')||!&acd|if haslocaldir()|");
3998 ga_concat(&ga, (char_u *)"cd -|lcd -|elseif getcwd() ==# \"");
3999 ga_concat(&ga, cdp);
4000 ga_concat(&ga, (char_u *)"\"|cd -|endif|endif<CR>");
4001 vim_free(cdp);
3989 4002
3990 if (sendReply) 4003 if (sendReply)
3991 ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>"); 4004 ga_concat(&ga, (char_u *)":call SetupRemoteReplies()<CR>");
3992 ga_concat(&ga, (char_u *)":"); 4005 ga_concat(&ga, (char_u *)":");
3993 if (inicmd != NULL) 4006 if (inicmd != NULL)