diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-02-02 23:00:25 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-02-11 15:29:19 +0100 |
commit | 0a531ddf873202d258809207f6d85e09a5207b31 (patch) | |
tree | 382d2d5b470aff6dd1cacf19bf5b6d6f4f8d069c /src | |
parent | bbdb074aec4f5ae1f61c451fb059e83d790e173e (diff) | |
download | rneovim-0a531ddf873202d258809207f6d85e09a5207b31.tar.gz rneovim-0a531ddf873202d258809207f6d85e09a5207b31.tar.bz2 rneovim-0a531ddf873202d258809207f6d85e09a5207b31.zip |
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)
https://github.com/vim/vim/commit/398ee7326b78b892a5c8380dfe3f2521a64b4fa7
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds2.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 27a96bb403..5975ca43e6 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -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 /// 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); while (*str != NUL) { 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. 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; int i; - get_arglist(&ga, str); + get_arglist(&ga, str, true); if (wig) { 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 *p; int match; + int arg_escaped = true; // Set default argument for ":argadd" command. if (what == AL_ADD && *str == NUL) { @@ -1616,10 +1622,11 @@ static int do_arglist(char_u *str, int what, int after) return FAIL; } str = curbuf->b_fname; + arg_escaped = false; } // Collect all file name arguments in "new_ga". - get_arglist(&new_ga, str); + get_arglist(&new_ga, str, arg_escaped); if (what == AL_DEL) { regmatch_T regmatch; |