0
0
mirror of https://github.com/vim/vim.git synced 2025-07-25 10:54:51 -04:00

updated for version 7.2-262

This commit is contained in:
Bram Moolenaar 2009-09-18 15:25:52 +00:00
parent 194b94c5a8
commit 67b891e16c
3 changed files with 15 additions and 9 deletions

View File

@ -3266,7 +3266,6 @@ nextwild(xp, type, options)
int i, j; int i, j;
char_u *p1; char_u *p1;
char_u *p2; char_u *p2;
int oldlen;
int difflen; int difflen;
int v; int v;
@ -3291,7 +3290,7 @@ nextwild(xp, type, options)
out_flush(); out_flush();
i = (int)(xp->xp_pattern - ccline.cmdbuff); i = (int)(xp->xp_pattern - ccline.cmdbuff);
oldlen = ccline.cmdpos - i; xp->xp_pattern_len = ccline.cmdpos - i;
if (type == WILD_NEXT || type == WILD_PREV) if (type == WILD_NEXT || type == WILD_PREV)
{ {
@ -3305,18 +3304,20 @@ nextwild(xp, type, options)
/* /*
* Translate string into pattern and expand it. * Translate string into pattern and expand it.
*/ */
if ((p1 = addstar(&ccline.cmdbuff[i], oldlen, xp->xp_context)) == NULL) if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len,
xp->xp_context)) == NULL)
p2 = NULL; p2 = NULL;
else else
{ {
p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], oldlen), p2 = ExpandOne(xp, p1,
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
|options, type); |options, type);
vim_free(p1); vim_free(p1);
/* longest match: make sure it is not shorter (happens with :help */ /* longest match: make sure it is not shorter (happens with :help */
if (p2 != NULL && type == WILD_LONGEST) if (p2 != NULL && type == WILD_LONGEST)
{ {
for (j = 0; j < oldlen; ++j) for (j = 0; j < xp->xp_pattern_len; ++j)
if (ccline.cmdbuff[i + j] == '*' if (ccline.cmdbuff[i + j] == '*'
|| ccline.cmdbuff[i + j] == '?') || ccline.cmdbuff[i + j] == '?')
break; break;
@ -3331,7 +3332,7 @@ nextwild(xp, type, options)
if (p2 != NULL && !got_int) if (p2 != NULL && !got_int)
{ {
difflen = (int)STRLEN(p2) - oldlen; difflen = (int)STRLEN(p2) - xp->xp_pattern_len;
if (ccline.cmdlen + difflen > ccline.cmdbufflen - 4) if (ccline.cmdlen + difflen > ccline.cmdbufflen - 4)
{ {
v = realloc_cmdbuff(ccline.cmdlen + difflen); v = realloc_cmdbuff(ccline.cmdlen + difflen);
@ -3620,6 +3621,7 @@ ExpandInit(xp)
expand_T *xp; expand_T *xp;
{ {
xp->xp_pattern = NULL; xp->xp_pattern = NULL;
xp->xp_pattern_len = 0;
xp->xp_backslash = XP_BS_NONE; xp->xp_backslash = XP_BS_NONE;
#ifndef BACKSLASH_IN_FILENAME #ifndef BACKSLASH_IN_FILENAME
xp->xp_shell = FALSE; xp->xp_shell = FALSE;
@ -4311,8 +4313,8 @@ expand_cmdline(xp, str, col, matchcount, matches)
} }
/* add star to file name, or convert to regexp if not exp. files. */ /* add star to file name, or convert to regexp if not exp. files. */
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len = (int)(str + col - xp->xp_pattern);
(int)(str + col - xp->xp_pattern), xp->xp_context); file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
if (file_str == NULL) if (file_str == NULL)
return EXPAND_UNSUCCESSFUL; return EXPAND_UNSUCCESSFUL;
@ -4781,7 +4783,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
sprintf((char *)num, "%d", ccline.cmdpos); sprintf((char *)num, "%d", ccline.cmdpos);
args[1] = ccline.cmdbuff; args[1] = ccline.cmdbuff;
} }
args[0] = xp->xp_pattern; args[0] = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len);
args[2] = num; args[2] = num;
/* Save the cmdline, we don't know what the function may do. */ /* Save the cmdline, we don't know what the function may do. */
@ -4797,6 +4799,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
if (ccline.cmdbuff != NULL) if (ccline.cmdbuff != NULL)
ccline.cmdbuff[ccline.cmdlen] = keep; ccline.cmdbuff[ccline.cmdlen] = keep;
vim_free(args[0]);
return ret; return ret;
} }

View File

@ -432,6 +432,7 @@ typedef struct expand
{ {
int xp_context; /* type of expansion */ int xp_context; /* type of expansion */
char_u *xp_pattern; /* start of item to expand */ char_u *xp_pattern; /* start of item to expand */
int xp_pattern_len; /* bytes in xp_pattern before cursor */
#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) #if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
char_u *xp_arg; /* completion function */ char_u *xp_arg; /* completion function */
int xp_scriptID; /* SID for completion function */ int xp_scriptID; /* SID for completion function */

View File

@ -676,6 +676,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 */
/**/
262,
/**/ /**/
261, 261,
/**/ /**/