mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0847: :argadd without argument can't handle space in file name
Problem: :argadd without argument can't handle space in file name. (Harm te
Hennepe)
Solution: Escape the space. (Yasuhiro Matsumoto, closes vim/vim#1917)
398ee7326b
This commit is contained in:
parent
bbdb074aec
commit
0a531ddf87
@ -1558,12 +1558,17 @@ static char_u *do_one_arg(char_u *str)
|
|||||||
|
|
||||||
/// Separate the arguments in "str" and return a list of pointers in the
|
/// Separate the arguments in "str" and return a list of pointers in the
|
||||||
/// growarray "gap".
|
/// growarray "gap".
|
||||||
void get_arglist(garray_T *gap, char_u *str)
|
static void get_arglist(garray_T *gap, char_u *str, int escaped)
|
||||||
{
|
{
|
||||||
ga_init(gap, (int)sizeof(char_u *), 20);
|
ga_init(gap, (int)sizeof(char_u *), 20);
|
||||||
while (*str != NUL) {
|
while (*str != NUL) {
|
||||||
GA_APPEND(char_u *, gap, str);
|
GA_APPEND(char_u *, gap, str);
|
||||||
|
|
||||||
|
// If str is escaped, don't handle backslashes or spaces
|
||||||
|
if (!escaped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Isolate one argument, change it in-place, put a NUL after it.
|
// Isolate one argument, change it in-place, put a NUL after it.
|
||||||
str = do_one_arg(str);
|
str = do_one_arg(str);
|
||||||
}
|
}
|
||||||
@ -1578,7 +1583,7 @@ int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
|
|||||||
garray_T ga;
|
garray_T ga;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
get_arglist(&ga, str);
|
get_arglist(&ga, str, true);
|
||||||
|
|
||||||
if (wig) {
|
if (wig) {
|
||||||
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
|
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
|
||||||
@ -1609,6 +1614,7 @@ static int do_arglist(char_u *str, int what, int after)
|
|||||||
char_u **exp_files;
|
char_u **exp_files;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int match;
|
int match;
|
||||||
|
int arg_escaped = true;
|
||||||
|
|
||||||
// Set default argument for ":argadd" command.
|
// Set default argument for ":argadd" command.
|
||||||
if (what == AL_ADD && *str == NUL) {
|
if (what == AL_ADD && *str == NUL) {
|
||||||
@ -1616,10 +1622,11 @@ static int do_arglist(char_u *str, int what, int after)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
str = curbuf->b_fname;
|
str = curbuf->b_fname;
|
||||||
|
arg_escaped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect all file name arguments in "new_ga".
|
// Collect all file name arguments in "new_ga".
|
||||||
get_arglist(&new_ga, str);
|
get_arglist(&new_ga, str, arg_escaped);
|
||||||
|
|
||||||
if (what == AL_DEL) {
|
if (what == AL_DEL) {
|
||||||
regmatch_T regmatch;
|
regmatch_T regmatch;
|
||||||
|
Loading…
Reference in New Issue
Block a user