mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.4.689
Problem: On MS-Windows, when 'autochdir' is set, diff mode with files in different directories does not work. (Axel Bender) Solution: Remember the current directory and use it where needed. (Christian Brabandt)
This commit is contained in:
20
src/main.c
20
src/main.c
@@ -110,7 +110,7 @@ static void check_tty __ARGS((mparm_T *parmp));
|
|||||||
static void read_stdin __ARGS((void));
|
static void read_stdin __ARGS((void));
|
||||||
static void create_windows __ARGS((mparm_T *parmp));
|
static void create_windows __ARGS((mparm_T *parmp));
|
||||||
# ifdef FEAT_WINDOWS
|
# ifdef FEAT_WINDOWS
|
||||||
static void edit_buffers __ARGS((mparm_T *parmp));
|
static void edit_buffers __ARGS((mparm_T *parmp, char_u *cwd));
|
||||||
# endif
|
# endif
|
||||||
static void exe_pre_commands __ARGS((mparm_T *parmp));
|
static void exe_pre_commands __ARGS((mparm_T *parmp));
|
||||||
static void exe_commands __ARGS((mparm_T *parmp));
|
static void exe_commands __ARGS((mparm_T *parmp));
|
||||||
@@ -168,6 +168,7 @@ main
|
|||||||
char_u *fname = NULL; /* file name from command line */
|
char_u *fname = NULL; /* file name from command line */
|
||||||
mparm_T params; /* various parameters passed between
|
mparm_T params; /* various parameters passed between
|
||||||
* main() and other functions. */
|
* main() and other functions. */
|
||||||
|
char_u *cwd = NULL; /* current workding dir on startup */
|
||||||
#ifdef STARTUPTIME
|
#ifdef STARTUPTIME
|
||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
@@ -404,12 +405,17 @@ main
|
|||||||
*/
|
*/
|
||||||
if (!params.literal)
|
if (!params.literal)
|
||||||
{
|
{
|
||||||
|
cwd = alloc(MAXPATHL);
|
||||||
|
if (cwd != NULL)
|
||||||
|
mch_dirname(cwd, MAXPATHL);
|
||||||
/* Temporarily add '(' and ')' to 'isfname'. These are valid
|
/* Temporarily add '(' and ')' to 'isfname'. These are valid
|
||||||
* filename characters but are excluded from 'isfname' to make
|
* filename characters but are excluded from 'isfname' to make
|
||||||
* "gf" work on a file name in parenthesis (e.g.: see vim.h). */
|
* "gf" work on a file name in parenthesis (e.g.: see vim.h). */
|
||||||
do_cmdline_cmd((char_u *)":set isf+=(,)");
|
do_cmdline_cmd((char_u *)":set isf+=(,)");
|
||||||
alist_expand(NULL, 0);
|
alist_expand(NULL, 0);
|
||||||
do_cmdline_cmd((char_u *)":set isf&");
|
do_cmdline_cmd((char_u *)":set isf&");
|
||||||
|
if (cwd != NULL)
|
||||||
|
mch_chdir((char *)cwd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
fname = alist_name(&GARGLIST[0]);
|
fname = alist_name(&GARGLIST[0]);
|
||||||
@@ -435,6 +441,8 @@ main
|
|||||||
* If the cd fails, it doesn't matter.
|
* If the cd fails, it doesn't matter.
|
||||||
*/
|
*/
|
||||||
(void)vim_chdirfile(fname);
|
(void)vim_chdirfile(fname);
|
||||||
|
if (cwd != NULL)
|
||||||
|
mch_dirnamem(cwd, MAXPATHL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TIME_MSG("expanding arguments");
|
TIME_MSG("expanding arguments");
|
||||||
@@ -488,6 +496,8 @@ main
|
|||||||
expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
|
expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
|
||||||
vim_chdir(NameBuff);
|
vim_chdir(NameBuff);
|
||||||
}
|
}
|
||||||
|
if (cwd != NULL)
|
||||||
|
mch_dirname(cwd, MAXPATHL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -900,8 +910,9 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
|
|||||||
* If opened more than one window, start editing files in the other
|
* If opened more than one window, start editing files in the other
|
||||||
* windows.
|
* windows.
|
||||||
*/
|
*/
|
||||||
edit_buffers(¶ms);
|
edit_buffers(¶ms, cwd);
|
||||||
#endif
|
#endif
|
||||||
|
vim_free(cwd);
|
||||||
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
if (params.diff_mode)
|
if (params.diff_mode)
|
||||||
@@ -2730,8 +2741,9 @@ create_windows(parmp)
|
|||||||
* windows. make_windows() has already opened the windows.
|
* windows. make_windows() has already opened the windows.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
edit_buffers(parmp)
|
edit_buffers(parmp, cwd)
|
||||||
mparm_T *parmp;
|
mparm_T *parmp;
|
||||||
|
char_u *cwd; /* current working dir */
|
||||||
{
|
{
|
||||||
int arg_idx; /* index in argument list */
|
int arg_idx; /* index in argument list */
|
||||||
int i;
|
int i;
|
||||||
@@ -2756,6 +2768,8 @@ edit_buffers(parmp)
|
|||||||
arg_idx = 1;
|
arg_idx = 1;
|
||||||
for (i = 1; i < parmp->window_count; ++i)
|
for (i = 1; i < parmp->window_count; ++i)
|
||||||
{
|
{
|
||||||
|
if (cwd != NULL)
|
||||||
|
mch_chdir((char *)cwd);
|
||||||
/* When w_arg_idx is -1 remove the window (see create_windows()). */
|
/* When w_arg_idx is -1 remove the window (see create_windows()). */
|
||||||
if (curwin->w_arg_idx == -1)
|
if (curwin->w_arg_idx == -1)
|
||||||
{
|
{
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
689,
|
||||||
/**/
|
/**/
|
||||||
688,
|
688,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user