* Separate the arguments in "str" and return a list of pointers in the
* growarray "gap".
*/
- int
-get_arglist(garray_T *gap, char_u *str)
+ static int
+get_arglist(garray_T *gap, char_u *str, int escaped)
{
ga_init2(gap, (int)sizeof(char_u *), 20);
while (*str != NUL)
}
((char_u **)gap->ga_data)[gap->ga_len++] = str;
+ /* If str is escaped, don't handle backslashes or spaces */
+ if (!escaped)
+ return OK;
+
/* Isolate one argument, change it in-place, put a NUL after it. */
str = do_one_arg(str);
}
garray_T ga;
int i;
- if (get_arglist(&ga, str) == FAIL)
+ if (get_arglist(&ga, str, TRUE) == FAIL)
return FAIL;
if (wig == TRUE)
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
char_u *p;
int match;
#endif
+ int arg_escaped = TRUE;
/*
* Set default argument for ":argadd" command.
if (curbuf->b_ffname == NULL)
return FAIL;
str = curbuf->b_fname;
+ arg_escaped = FALSE;
}
/*
* Collect all file name arguments in "new_ga".
*/
- if (get_arglist(&new_ga, str) == FAIL)
+ if (get_arglist(&new_ga, str, arg_escaped) == FAIL)
return FAIL;
#ifdef FEAT_LISTCMDS
int check_changed_any(int hidden, int unload);
int check_fname(void);
int buf_write_all(buf_T *buf, int forceit);
-int get_arglist(garray_T *gap, char_u *str);
int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, int wig);
void set_arglist(char_u *str);
void check_arg_idx(win_T *win);
%argd
edit d
arga
- call assert_equal(len(argv()), 1)
- call assert_equal(get(argv(), 0, ''), 'd')
+ call assert_equal(1, len(argv()))
+ call assert_equal('d', get(argv(), 0, ''))
+
+ %argd
+ edit some\ file
+ arga
+ call assert_equal(1, len(argv()))
+ call assert_equal('some file', get(argv(), 0, ''))
%argd
new
arga
- call assert_equal(len(argv()), 0)
+ call assert_equal(0, len(argv()))
endfunc
func Init_abc()