mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.3.237
Problem: "filetype" completion doesn't work on Windows. (Yue Wu) Solution: Don't use a glob pattern for the directories, use a list of directories. (Dominique Pelle)
This commit is contained in:
@@ -110,7 +110,7 @@ static int ExpandFromContext __ARGS((expand_T *xp, char_u *, int *, char_u ***,
|
|||||||
static int expand_showtail __ARGS((expand_T *xp));
|
static int expand_showtail __ARGS((expand_T *xp));
|
||||||
#ifdef FEAT_CMDL_COMPL
|
#ifdef FEAT_CMDL_COMPL
|
||||||
static int expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg));
|
static int expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg));
|
||||||
static int ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname));
|
static int ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname[]));
|
||||||
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
|
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
|
||||||
static int ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
|
static int ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
|
||||||
static int ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
|
static int ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
|
||||||
@@ -4536,13 +4536,25 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
|||||||
|| xp->xp_context == EXPAND_TAGS_LISTFILES)
|
|| xp->xp_context == EXPAND_TAGS_LISTFILES)
|
||||||
return expand_tags(xp->xp_context == EXPAND_TAGS, pat, num_file, file);
|
return expand_tags(xp->xp_context == EXPAND_TAGS, pat, num_file, file);
|
||||||
if (xp->xp_context == EXPAND_COLORS)
|
if (xp->xp_context == EXPAND_COLORS)
|
||||||
return ExpandRTDir(pat, num_file, file, "colors");
|
{
|
||||||
|
char *directories[] = {"colors", NULL};
|
||||||
|
return ExpandRTDir(pat, num_file, file, directories);
|
||||||
|
}
|
||||||
if (xp->xp_context == EXPAND_COMPILER)
|
if (xp->xp_context == EXPAND_COMPILER)
|
||||||
return ExpandRTDir(pat, num_file, file, "compiler");
|
{
|
||||||
|
char *directories[] = {"colors", NULL};
|
||||||
|
return ExpandRTDir(pat, num_file, file, directories);
|
||||||
|
}
|
||||||
if (xp->xp_context == EXPAND_OWNSYNTAX)
|
if (xp->xp_context == EXPAND_OWNSYNTAX)
|
||||||
return ExpandRTDir(pat, num_file, file, "syntax");
|
{
|
||||||
|
char *directories[] = {"syntax", NULL};
|
||||||
|
return ExpandRTDir(pat, num_file, file, directories);
|
||||||
|
}
|
||||||
if (xp->xp_context == EXPAND_FILETYPE)
|
if (xp->xp_context == EXPAND_FILETYPE)
|
||||||
return ExpandRTDir(pat, num_file, file, "{syntax,indent,ftplugin}");
|
{
|
||||||
|
char *directories[] = {"syntax", "indent", "ftplugin", NULL};
|
||||||
|
return ExpandRTDir(pat, num_file, file, directories);
|
||||||
|
}
|
||||||
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
|
# if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
|
||||||
if (xp->xp_context == EXPAND_USER_LIST)
|
if (xp->xp_context == EXPAND_USER_LIST)
|
||||||
return ExpandUserList(xp, num_file, file);
|
return ExpandUserList(xp, num_file, file);
|
||||||
@@ -4995,57 +5007,68 @@ ExpandUserList(xp, num_file, file)
|
|||||||
/*
|
/*
|
||||||
* Expand color scheme, compiler or filetype names:
|
* Expand color scheme, compiler or filetype names:
|
||||||
* 'runtimepath'/{dirnames}/{pat}.vim
|
* 'runtimepath'/{dirnames}/{pat}.vim
|
||||||
* dirnames may contain one directory (ex: "colorscheme") or can be a glob
|
* "dirnames" is an array with one or more directory names.
|
||||||
* expression matching multiple directories (ex: "{syntax,ftplugin,indent}").
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
ExpandRTDir(pat, num_file, file, dirnames)
|
ExpandRTDir(pat, num_file, file, dirnames)
|
||||||
char_u *pat;
|
char_u *pat;
|
||||||
int *num_file;
|
int *num_file;
|
||||||
char_u ***file;
|
char_u ***file;
|
||||||
char *dirnames;
|
char *dirnames[];
|
||||||
{
|
{
|
||||||
char_u *all;
|
char_u *matches;
|
||||||
char_u *s;
|
char_u *s;
|
||||||
char_u *e;
|
char_u *e;
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
|
int i;
|
||||||
|
int pat_len;
|
||||||
|
|
||||||
*num_file = 0;
|
*num_file = 0;
|
||||||
*file = NULL;
|
*file = NULL;
|
||||||
s = alloc((unsigned)(STRLEN(pat) + STRLEN(dirnames) + 7));
|
pat_len = STRLEN(pat);
|
||||||
if (s == NULL)
|
ga_init2(&ga, (int)sizeof(char *), 10);
|
||||||
return FAIL;
|
|
||||||
sprintf((char *)s, "%s/%s*.vim", dirnames, pat);
|
|
||||||
all = globpath(p_rtp, s, 0);
|
|
||||||
vim_free(s);
|
|
||||||
if (all == NULL)
|
|
||||||
return FAIL;
|
|
||||||
|
|
||||||
ga_init2(&ga, (int)sizeof(char *), 3);
|
for (i = 0; dirnames[i] != NULL; ++i)
|
||||||
for (s = all; *s != NUL; s = e)
|
|
||||||
{
|
{
|
||||||
e = vim_strchr(s, '\n');
|
s = alloc((unsigned)(STRLEN(dirnames[i]) + pat_len + 7));
|
||||||
if (e == NULL)
|
if (s == NULL)
|
||||||
e = s + STRLEN(s);
|
|
||||||
if (ga_grow(&ga, 1) == FAIL)
|
|
||||||
break;
|
|
||||||
if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0)
|
|
||||||
{
|
{
|
||||||
for (s = e - 4; s > all; mb_ptr_back(all, s))
|
ga_clear_strings(&ga);
|
||||||
if (*s == '\n' || vim_ispathsep(*s))
|
return FAIL;
|
||||||
break;
|
|
||||||
++s;
|
|
||||||
((char_u **)ga.ga_data)[ga.ga_len] =
|
|
||||||
vim_strnsave(s, (int)(e - s - 4));
|
|
||||||
++ga.ga_len;
|
|
||||||
}
|
}
|
||||||
if (*e != NUL)
|
sprintf((char *)s, "%s/%s*.vim", dirnames[i], pat);
|
||||||
++e;
|
matches = globpath(p_rtp, s, 0);
|
||||||
|
vim_free(s);
|
||||||
|
if (matches == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (s = matches; *s != NUL; s = e)
|
||||||
|
{
|
||||||
|
e = vim_strchr(s, '\n');
|
||||||
|
if (e == NULL)
|
||||||
|
e = s + STRLEN(s);
|
||||||
|
if (ga_grow(&ga, 1) == FAIL)
|
||||||
|
break;
|
||||||
|
if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0)
|
||||||
|
{
|
||||||
|
for (s = e - 4; s > matches; mb_ptr_back(matches, s))
|
||||||
|
if (*s == '\n' || vim_ispathsep(*s))
|
||||||
|
break;
|
||||||
|
++s;
|
||||||
|
((char_u **)ga.ga_data)[ga.ga_len] =
|
||||||
|
vim_strnsave(s, (int)(e - s - 4));
|
||||||
|
++ga.ga_len;
|
||||||
|
}
|
||||||
|
if (*e != NUL)
|
||||||
|
++e;
|
||||||
|
}
|
||||||
|
vim_free(matches);
|
||||||
}
|
}
|
||||||
vim_free(all);
|
if (ga.ga_len == 0)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
/* Sort and remove duplicates which can happen when specifying multiple
|
/* Sort and remove duplicates which can happen when specifying multiple
|
||||||
* directories in dirnames such as "{syntax,ftplugin,indent}". */
|
* directories in dirnames. */
|
||||||
remove_duplicates(&ga);
|
remove_duplicates(&ga);
|
||||||
|
|
||||||
*file = ga.ga_data;
|
*file = ga.ga_data;
|
||||||
|
@@ -709,6 +709,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 */
|
||||||
|
/**/
|
||||||
|
237,
|
||||||
/**/
|
/**/
|
||||||
236,
|
236,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user