0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

updated for version 7.0112

This commit is contained in:
Bram Moolenaar
2005-07-21 21:08:21 +00:00
parent a3ffd9c780
commit 4536002e30
12 changed files with 367 additions and 46 deletions

View File

@@ -92,6 +92,7 @@ static void redrawcmdprompt __ARGS((void));
static void cursorcmd __ARGS((void));
static int ccheck_abbr __ARGS((int));
static int nextwild __ARGS((expand_T *xp, int type, int options));
static void escape_fname __ARGS((char_u **pp));
static int showmatches __ARGS((expand_T *xp, int wildmenu));
static void set_expand_context __ARGS((expand_T *xp));
static int ExpandFromContext __ARGS((expand_T *xp, char_u *, int *, char_u ***, int));
@@ -3365,18 +3366,14 @@ ExpandEscape(xp, str, numfiles, files, options)
/* If 'str' starts with "\~", replace "~" at start of
* files[i] with "\~". */
if (str[0] == '\\' && str[1] == '~' && files[i][0] == '~')
{
p = alloc((unsigned)(STRLEN(files[i]) + 2));
if (p != NULL)
{
p[0] = '\\';
STRCPY(p + 1, files[i]);
vim_free(files[i]);
files[i] = p;
}
}
escape_fname(&files[i]);
}
xp->xp_backslash = XP_BS_NONE;
/* If the first file starts with a '+' escape it. Otherwise it
* could be seen as "+cmd". */
if (*files[0] == '+')
escape_fname(&files[0]);
}
else if (xp->xp_context == EXPAND_TAGS)
{
@@ -3397,6 +3394,25 @@ ExpandEscape(xp, str, numfiles, files, options)
}
}
/*
* Put a backslash before the file name in "pp", which is in allocated memory.
*/
static void
escape_fname(pp)
char_u **pp;
{
char_u *p;
p = alloc((unsigned)(STRLEN(*pp) + 2));
if (p != NULL)
{
p[0] = '\\';
STRCPY(p + 1, *pp);
vim_free(*pp);
*pp = p;
}
}
/*
* For each file name in files[num_files]:
* If 'orig_pat' starts with "~/", replace the home directory with "~".