forked from aniani/vim
updated for version 7.1-126
This commit is contained in:
@@ -4261,12 +4261,12 @@ alist_name(aep)
|
|||||||
do_arg_all(count, forceit, keep_tabs)
|
do_arg_all(count, forceit, keep_tabs)
|
||||||
int count;
|
int count;
|
||||||
int forceit; /* hide buffers in current windows */
|
int forceit; /* hide buffers in current windows */
|
||||||
int keep_tabs; /* keep curren tabs, for ":tab drop file" */
|
int keep_tabs; /* keep current tabs, for ":tab drop file" */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
win_T *wp, *wpnext;
|
win_T *wp, *wpnext;
|
||||||
char_u *opened; /* array of flags for which args are open */
|
char_u *opened; /* array of flags for which args are open */
|
||||||
int opened_len; /* lenght of opened[] */
|
int opened_len; /* length of opened[] */
|
||||||
int use_firstwin = FALSE; /* use first window for arglist */
|
int use_firstwin = FALSE; /* use first window for arglist */
|
||||||
int split_ret = OK;
|
int split_ret = OK;
|
||||||
int p_ea_save;
|
int p_ea_save;
|
||||||
@@ -4946,10 +4946,7 @@ read_viminfo_bufferlist(virp, writing)
|
|||||||
/* Expand "~/" in the file name at "line + 1" to a full path.
|
/* Expand "~/" in the file name at "line + 1" to a full path.
|
||||||
* Then try shortening it by comparing with the current directory */
|
* Then try shortening it by comparing with the current directory */
|
||||||
expand_env(xline, NameBuff, MAXPATHL);
|
expand_env(xline, NameBuff, MAXPATHL);
|
||||||
mch_dirname(IObuff, IOSIZE);
|
sfname = shorten_fname1(NameBuff);
|
||||||
sfname = shorten_fname(NameBuff, IObuff);
|
|
||||||
if (sfname == NULL)
|
|
||||||
sfname = NameBuff;
|
|
||||||
|
|
||||||
buf = buflist_new(NameBuff, sfname, (linenr_T)0, BLN_LISTED);
|
buf = buflist_new(NameBuff, sfname, (linenr_T)0, BLN_LISTED);
|
||||||
if (buf != NULL) /* just in case... */
|
if (buf != NULL) /* just in case... */
|
||||||
|
@@ -276,7 +276,6 @@ static void ex_popup __ARGS((exarg_T *eap));
|
|||||||
static void ex_swapname __ARGS((exarg_T *eap));
|
static void ex_swapname __ARGS((exarg_T *eap));
|
||||||
static void ex_syncbind __ARGS((exarg_T *eap));
|
static void ex_syncbind __ARGS((exarg_T *eap));
|
||||||
static void ex_read __ARGS((exarg_T *eap));
|
static void ex_read __ARGS((exarg_T *eap));
|
||||||
static void ex_cd __ARGS((exarg_T *eap));
|
|
||||||
static void ex_pwd __ARGS((exarg_T *eap));
|
static void ex_pwd __ARGS((exarg_T *eap));
|
||||||
static void ex_equal __ARGS((exarg_T *eap));
|
static void ex_equal __ARGS((exarg_T *eap));
|
||||||
static void ex_sleep __ARGS((exarg_T *eap));
|
static void ex_sleep __ARGS((exarg_T *eap));
|
||||||
@@ -7778,7 +7777,7 @@ free_cd_dir()
|
|||||||
/*
|
/*
|
||||||
* ":cd", ":lcd", ":chdir" and ":lchdir".
|
* ":cd", ":lcd", ":chdir" and ":lchdir".
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
ex_cd(eap)
|
ex_cd(eap)
|
||||||
exarg_T *eap;
|
exarg_T *eap;
|
||||||
{
|
{
|
||||||
|
23
src/fileio.c
23
src/fileio.c
@@ -114,7 +114,7 @@ struct bw_info
|
|||||||
{
|
{
|
||||||
int bw_fd; /* file descriptor */
|
int bw_fd; /* file descriptor */
|
||||||
char_u *bw_buf; /* buffer with data to be written */
|
char_u *bw_buf; /* buffer with data to be written */
|
||||||
int bw_len; /* lenght of data */
|
int bw_len; /* length of data */
|
||||||
#ifdef HAS_BW_FLAGS
|
#ifdef HAS_BW_FLAGS
|
||||||
int bw_flags; /* FIO_ flags */
|
int bw_flags; /* FIO_ flags */
|
||||||
#endif
|
#endif
|
||||||
@@ -5553,6 +5553,27 @@ make_bom(buf, name)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to find a shortname by comparing the fullname with the current
|
||||||
|
* directory.
|
||||||
|
* Returns "full_path" or pointer into "full_path" if shortened.
|
||||||
|
*/
|
||||||
|
char_u *
|
||||||
|
shorten_fname1(full_path)
|
||||||
|
char_u *full_path;
|
||||||
|
{
|
||||||
|
char_u dirname[MAXPATHL];
|
||||||
|
char_u *p = full_path;
|
||||||
|
|
||||||
|
if (mch_dirname(dirname, MAXPATHL) == OK)
|
||||||
|
{
|
||||||
|
p = shorten_fname(full_path, dirname);
|
||||||
|
if (p == NULL || *p == NUL)
|
||||||
|
p = full_path;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to find a shortname by comparing the fullname with the current
|
* Try to find a shortname by comparing the fullname with the current
|
||||||
* directory.
|
* directory.
|
||||||
|
@@ -1272,7 +1272,6 @@ gui_mch_browse(int saving,
|
|||||||
GtkWidget *fc;
|
GtkWidget *fc;
|
||||||
#endif
|
#endif
|
||||||
char_u dirbuf[MAXPATHL];
|
char_u dirbuf[MAXPATHL];
|
||||||
char_u *p;
|
|
||||||
|
|
||||||
# ifdef HAVE_GTK2
|
# ifdef HAVE_GTK2
|
||||||
title = CONVERT_TO_UTF8(title);
|
title = CONVERT_TO_UTF8(title);
|
||||||
@@ -1363,11 +1362,7 @@ gui_mch_browse(int saving,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* shorten the file name if possible */
|
/* shorten the file name if possible */
|
||||||
mch_dirname(dirbuf, MAXPATHL);
|
return vim_strsave(shorten_fname1(gui.browse_fname));
|
||||||
p = shorten_fname(gui.browse_fname, dirbuf);
|
|
||||||
if (p == NULL)
|
|
||||||
p = gui.browse_fname;
|
|
||||||
return vim_strsave(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_GTK2) || defined(PROTO)
|
#if defined(HAVE_GTK2) || defined(PROTO)
|
||||||
@@ -1427,11 +1422,7 @@ gui_mch_browsedir(
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* shorten the file name if possible */
|
/* shorten the file name if possible */
|
||||||
mch_dirname(dirbuf, MAXPATHL);
|
p = vim_strsave(shorten_fname1(dirname));
|
||||||
p = shorten_fname(dirname, dirbuf);
|
|
||||||
if (p == NULL || *p == NUL)
|
|
||||||
p = dirname;
|
|
||||||
p = vim_strsave(p);
|
|
||||||
g_free(dirname);
|
g_free(dirname);
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
|
@@ -3301,11 +3301,7 @@ gui_mch_browseW(
|
|||||||
SetFocus(s_hwnd);
|
SetFocus(s_hwnd);
|
||||||
|
|
||||||
/* Shorten the file name if possible */
|
/* Shorten the file name if possible */
|
||||||
mch_dirname(IObuff, IOSIZE);
|
return vim_strsave(shorten_fname1((char_u *)fileBuf));
|
||||||
p = shorten_fname((char_u *)fileBuf, IObuff);
|
|
||||||
if (p == NULL)
|
|
||||||
p = (char_u *)fileBuf;
|
|
||||||
return vim_strsave(p);
|
|
||||||
}
|
}
|
||||||
# endif /* FEAT_MBYTE */
|
# endif /* FEAT_MBYTE */
|
||||||
|
|
||||||
@@ -3450,11 +3446,7 @@ gui_mch_browse(
|
|||||||
SetFocus(s_hwnd);
|
SetFocus(s_hwnd);
|
||||||
|
|
||||||
/* Shorten the file name if possible */
|
/* Shorten the file name if possible */
|
||||||
mch_dirname(IObuff, IOSIZE);
|
return vim_strsave(shorten_fname1((char_u *)fileBuf));
|
||||||
p = shorten_fname((char_u *)fileBuf, IObuff);
|
|
||||||
if (p == NULL)
|
|
||||||
p = (char_u *)fileBuf;
|
|
||||||
return vim_strsave(p);
|
|
||||||
}
|
}
|
||||||
#endif /* FEAT_BROWSE */
|
#endif /* FEAT_BROWSE */
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ void ex_splitview __ARGS((exarg_T *eap));
|
|||||||
void tabpage_new __ARGS((void));
|
void tabpage_new __ARGS((void));
|
||||||
void do_exedit __ARGS((exarg_T *eap, win_T *old_curwin));
|
void do_exedit __ARGS((exarg_T *eap, win_T *old_curwin));
|
||||||
void free_cd_dir __ARGS((void));
|
void free_cd_dir __ARGS((void));
|
||||||
|
void ex_cd __ARGS((exarg_T *eap));
|
||||||
void do_sleep __ARGS((long msec));
|
void do_sleep __ARGS((long msec));
|
||||||
int vim_mkdir_emsg __ARGS((char_u *name, int prot));
|
int vim_mkdir_emsg __ARGS((char_u *name, int prot));
|
||||||
FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode));
|
FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode));
|
||||||
|
@@ -6,6 +6,7 @@ int check_file_readonly __ARGS((char_u *fname, int perm));
|
|||||||
int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering));
|
int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering));
|
||||||
void msg_add_fname __ARGS((buf_T *buf, char_u *fname));
|
void msg_add_fname __ARGS((buf_T *buf, char_u *fname));
|
||||||
void msg_add_lines __ARGS((int insert_space, long lnum, long nchars));
|
void msg_add_lines __ARGS((int insert_space, long lnum, long nchars));
|
||||||
|
char_u *shorten_fname1 __ARGS((char_u *full_path));
|
||||||
char_u *shorten_fname __ARGS((char_u *full_path, char_u *dir_name));
|
char_u *shorten_fname __ARGS((char_u *full_path, char_u *dir_name));
|
||||||
void shorten_fnames __ARGS((int force));
|
void shorten_fnames __ARGS((int force));
|
||||||
void shorten_filenames __ARGS((char_u **fnames, int count));
|
void shorten_filenames __ARGS((char_u **fnames, int count));
|
||||||
|
@@ -2972,6 +2972,7 @@ ex_vimgrep(eap)
|
|||||||
regmmatch_T regmatch;
|
regmmatch_T regmatch;
|
||||||
int fcount;
|
int fcount;
|
||||||
char_u **fnames;
|
char_u **fnames;
|
||||||
|
char_u *fname;
|
||||||
char_u *s;
|
char_u *s;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int fi;
|
int fi;
|
||||||
@@ -2995,6 +2996,9 @@ ex_vimgrep(eap)
|
|||||||
int flags = 0;
|
int flags = 0;
|
||||||
colnr_T col;
|
colnr_T col;
|
||||||
long tomatch;
|
long tomatch;
|
||||||
|
char_u dirname_start[MAXPATHL];
|
||||||
|
char_u dirname_now[MAXPATHL];
|
||||||
|
char_u *target_dir = NULL;
|
||||||
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
@@ -3069,17 +3073,23 @@ ex_vimgrep(eap)
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remember the current directory, because a BufRead autocommand that does
|
||||||
|
* ":lcd %:p:h" changes the meaning of short path names. */
|
||||||
|
mch_dirname(dirname_start, MAXPATHL);
|
||||||
|
|
||||||
seconds = (time_t)0;
|
seconds = (time_t)0;
|
||||||
for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
|
for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
|
||||||
{
|
{
|
||||||
|
fname = shorten_fname1(fnames[fi]);
|
||||||
if (time(NULL) > seconds)
|
if (time(NULL) > seconds)
|
||||||
{
|
{
|
||||||
/* Display the file name every second or so. */
|
/* Display the file name every second or so, show the user we are
|
||||||
|
* working on it. */
|
||||||
seconds = time(NULL);
|
seconds = time(NULL);
|
||||||
msg_start();
|
msg_start();
|
||||||
p = msg_strtrunc(fnames[fi], TRUE);
|
p = msg_strtrunc(fname, TRUE);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
msg_outtrans(fnames[fi]);
|
msg_outtrans(fname);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg_outtrans(p);
|
msg_outtrans(p);
|
||||||
@@ -3111,7 +3121,19 @@ ex_vimgrep(eap)
|
|||||||
|
|
||||||
/* Load file into a buffer, so that 'fileencoding' is detected,
|
/* Load file into a buffer, so that 'fileencoding' is detected,
|
||||||
* autocommands applied, etc. */
|
* autocommands applied, etc. */
|
||||||
buf = load_dummy_buffer(fnames[fi]);
|
buf = load_dummy_buffer(fname);
|
||||||
|
|
||||||
|
/* When autocommands changed directory: go back. We assume it was
|
||||||
|
* ":lcd %:p:h". */
|
||||||
|
mch_dirname(dirname_now, MAXPATHL);
|
||||||
|
if (STRCMP(dirname_start, dirname_now) != 0)
|
||||||
|
{
|
||||||
|
exarg_T ea;
|
||||||
|
|
||||||
|
ea.arg = dirname_start;
|
||||||
|
ea.cmdidx = CMD_lcd;
|
||||||
|
ex_cd(&ea);
|
||||||
|
}
|
||||||
|
|
||||||
p_mls = save_mls;
|
p_mls = save_mls;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
||||||
@@ -3125,7 +3147,7 @@ ex_vimgrep(eap)
|
|||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
{
|
||||||
if (!got_int)
|
if (!got_int)
|
||||||
smsg((char_u *)_("Cannot open file \"%s\""), fnames[fi]);
|
smsg((char_u *)_("Cannot open file \"%s\""), fname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3139,9 +3161,10 @@ ex_vimgrep(eap)
|
|||||||
while (vim_regexec_multi(®match, curwin, buf, lnum,
|
while (vim_regexec_multi(®match, curwin, buf, lnum,
|
||||||
col) > 0)
|
col) > 0)
|
||||||
{
|
{
|
||||||
|
;
|
||||||
if (qf_add_entry(qi, &prevp,
|
if (qf_add_entry(qi, &prevp,
|
||||||
NULL, /* dir */
|
NULL, /* dir */
|
||||||
fnames[fi],
|
fname,
|
||||||
0,
|
0,
|
||||||
ml_get_buf(buf,
|
ml_get_buf(buf,
|
||||||
regmatch.startpos[0].lnum + lnum, FALSE),
|
regmatch.startpos[0].lnum + lnum, FALSE),
|
||||||
@@ -3209,6 +3232,13 @@ ex_vimgrep(eap)
|
|||||||
|
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
{
|
{
|
||||||
|
/* If the buffer is still loaded we need to use the
|
||||||
|
* directory we jumped to below. */
|
||||||
|
if (buf == first_match_buf
|
||||||
|
&& target_dir == NULL
|
||||||
|
&& STRCMP(dirname_start, dirname_now) != 0)
|
||||||
|
target_dir = vim_strsave(dirname_now);
|
||||||
|
|
||||||
/* The buffer is still loaded, the Filetype autocommands
|
/* The buffer is still loaded, the Filetype autocommands
|
||||||
* need to be done now, in that buffer. And the modelines
|
* need to be done now, in that buffer. And the modelines
|
||||||
* need to be done (again). But not the window-local
|
* need to be done (again). But not the window-local
|
||||||
@@ -3252,6 +3282,16 @@ ex_vimgrep(eap)
|
|||||||
/* If we jumped to another buffer redrawing will already be
|
/* If we jumped to another buffer redrawing will already be
|
||||||
* taken care of. */
|
* taken care of. */
|
||||||
redraw_for_dummy = FALSE;
|
redraw_for_dummy = FALSE;
|
||||||
|
|
||||||
|
/* Jump to the directory used after loading the buffer. */
|
||||||
|
if (curbuf == first_match_buf && target_dir != NULL)
|
||||||
|
{
|
||||||
|
exarg_T ea;
|
||||||
|
|
||||||
|
ea.arg = target_dir;
|
||||||
|
ea.cmdidx = CMD_lcd;
|
||||||
|
ex_cd(&ea);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3269,6 +3309,7 @@ ex_vimgrep(eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
theend:
|
theend:
|
||||||
|
vim_free(target_dir);
|
||||||
vim_free(regmatch.regprog);
|
vim_free(regmatch.regprog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -666,6 +666,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 */
|
||||||
|
/**/
|
||||||
|
126,
|
||||||
/**/
|
/**/
|
||||||
125,
|
125,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user