comparison src/ex_docmd.c @ 153:19670b05ee32

updated for version 7.0047
author vimboss
date Wed, 02 Feb 2005 23:04:36 +0000
parents 5cc0aca13a3f
children 6df0106fc595
comparison
equal deleted inserted replaced
152:c837baf03d43 153:19670b05ee32
3178 p--; 3178 p--;
3179 if (*p == ' ' || *p == TAB) 3179 if (*p == ' ' || *p == TAB)
3180 p++; 3180 p++;
3181 xp->xp_pattern = p; 3181 xp->xp_pattern = p;
3182 3182
3183 if ((argt & XFILE) 3183 if (argt & XFILE)
3184 #ifdef FEAT_QUICKFIX
3185 || cmdidx == CMD_vimgrep
3186 || cmdidx == CMD_vimgrepadd
3187 || grep_internal(cmdidx)
3188 #endif
3189 )
3190 { 3184 {
3191 int in_quote = FALSE; 3185 int in_quote = FALSE;
3192 char_u *bow = NULL; /* Beginning of word */ 3186 char_u *bow = NULL; /* Beginning of word */
3193 3187
3194 /* 3188 /*
3917 if (eap->line2 == 0) 3911 if (eap->line2 == 0)
3918 eap->line2 = 1; 3912 eap->line2 = 1;
3919 } 3913 }
3920 } 3914 }
3921 3915
3916 #ifdef FEAT_QUICKFIX
3917 static char_u *skip_grep_pat __ARGS((exarg_T *eap));
3918
3919 /*
3920 * For a ":vimgrep" or ":vimgrepadd" command return a pointer past the
3921 * pattern. Otherwise return eap->arg.
3922 */
3923 static char_u *
3924 skip_grep_pat(eap)
3925 exarg_T *eap;
3926 {
3927 char_u *p = eap->arg;
3928
3929 if (*p != NUL && (eap->cmdidx == CMD_vimgrep
3930 || eap->cmdidx == CMD_vimgrepadd || grep_internal(eap->cmdidx)))
3931 {
3932 p = skip_vimgrep_pat(p, NULL);
3933 if (p == NULL)
3934 p = eap->arg;
3935 else if (*p != NUL && !vim_iswhite(*p))
3936 ++p; /* step past ending separator of /pat/ */
3937 }
3938 return p;
3939 }
3940 #endif
3941
3922 /* 3942 /*
3923 * Expand file name in Ex command argument. 3943 * Expand file name in Ex command argument.
3924 * Return FAIL for failure, OK otherwise. 3944 * Return FAIL for failure, OK otherwise.
3925 */ 3945 */
3926 int 3946 int
3933 char_u *repl; 3953 char_u *repl;
3934 int srclen; 3954 int srclen;
3935 char_u *p; 3955 char_u *p;
3936 int n; 3956 int n;
3937 3957
3958 #ifdef FEAT_QUICKFIX
3959 /* Skip a regexp pattern for ":vimgrep[add] pat file..." */
3960 p = skip_grep_pat(eap);
3961 #else
3962 p = eap->arg;
3963 #endif
3964
3938 /* 3965 /*
3939 * Decide to expand wildcards *before* replacing '%', '#', etc. If 3966 * Decide to expand wildcards *before* replacing '%', '#', etc. If
3940 * the file name contains a wildcard it should not cause expanding. 3967 * the file name contains a wildcard it should not cause expanding.
3941 * (it will be expanded anyway if there is a wildcard before replacing). 3968 * (it will be expanded anyway if there is a wildcard before replacing).
3942 */ 3969 */
3943 has_wildcards = mch_has_wildcard(eap->arg); 3970 has_wildcards = mch_has_wildcard(p);
3944 for (p = eap->arg; *p; ) 3971 while (*p != NUL)
3945 { 3972 {
3946 #ifdef FEAT_EVAL 3973 #ifdef FEAT_EVAL
3947 /* Skip over `=expr`, wildcards in it are not expanded. */ 3974 /* Skip over `=expr`, wildcards in it are not expanded. */
3948 if (p[0] == '`' && p[1] == '=') 3975 if (p[0] == '`' && p[1] == '=')
3949 { 3976 {
4223 separate_nextcmd(eap) 4250 separate_nextcmd(eap)
4224 exarg_T *eap; 4251 exarg_T *eap;
4225 { 4252 {
4226 char_u *p; 4253 char_u *p;
4227 4254
4255 #ifdef FEAT_QUICKFIX
4256 p = skip_grep_pat(eap);
4257 #else
4228 p = eap->arg; 4258 p = eap->arg;
4229 #ifdef FEAT_QUICKFIX
4230 if (*p != NUL && (eap->cmdidx == CMD_vimgrep
4231 || eap->cmdidx == CMD_vimgrepadd
4232 || grep_internal(eap->cmdidx)))
4233 {
4234 /* Skip over the pattern. */
4235 if (vim_isIDc(*p))
4236 p = skiptowhite(p);
4237 else
4238 {
4239 p = skip_regexp(p + 1, *p, TRUE, NULL);
4240 if (*p == *eap->arg)
4241 ++p;
4242 }
4243 }
4244 #endif 4259 #endif
4245 4260
4246 for ( ; *p; mb_ptr_adv(p)) 4261 for ( ; *p; mb_ptr_adv(p))
4247 { 4262 {
4248 if (*p == Ctrl_V) 4263 if (*p == Ctrl_V)