Patch 8.0.0847
Problem: :argadd without argument can't handle space in file name. (Harm te
Hennepe)
Solution: Escape the space. (Yasuhiro Matsumoto, closes #1917)
Files: src/ex_cmds2.c, src/proto/ex_cmds2.pro,
src/testdir/test_arglist.vim
*** ../vim-8.0.0846/src/ex_cmds2.c 2017-07-16 15:30:51.323226561 +0200
--- src/ex_cmds2.c 2017-08-03 14:20:57.963517811 +0200
***************
*** 2320,2327 ****
* Separate the arguments in "str" and return a list of pointers in the
* growarray "gap".
*/
! int
! get_arglist(garray_T *gap, char_u *str)
{
ga_init2(gap, (int)sizeof(char_u *), 20);
while (*str != NUL)
--- 2320,2327 ----
* Separate the arguments in "str" and return a list of pointers in the
* growarray "gap".
*/
! static int
! get_arglist(garray_T *gap, char_u *str, int escaped)
{
ga_init2(gap, (int)sizeof(char_u *), 20);
while (*str != NUL)
***************
*** 2333,2338 ****
--- 2333,2342 ----
}
((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);
}
***************
*** 2355,2361 ****
garray_T ga;
int i;
! if (get_arglist(&ga, str) == FAIL)
return FAIL;
if (wig == TRUE)
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
--- 2359,2365 ----
garray_T ga;
int i;
! if (get_arglist(&ga, str, TRUE) == FAIL)
return FAIL;
if (wig == TRUE)
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
***************
*** 2401,2406 ****
--- 2405,2411 ----
char_u *p;
int match;
#endif
+ int arg_escaped = TRUE;
/*
* Set default argument for ":argadd" command.
***************
*** 2410,2421 ****
if (curbuf->b_ffname == NULL)
return FAIL;
str = curbuf->b_fname;
}
/*
* Collect all file name arguments in "new_ga".
*/
! if (get_arglist(&new_ga, str) == FAIL)
return FAIL;
#ifdef FEAT_LISTCMDS
--- 2415,2427 ----
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, arg_escaped) == FAIL)
return FAIL;
#ifdef FEAT_LISTCMDS
*** ../vim-8.0.0846/src/proto/ex_cmds2.pro 2017-06-27 14:43:51.203020467
+0200
--- src/proto/ex_cmds2.pro 2017-08-03 14:21:02.163486874 +0200
***************
*** 52,58 ****
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);
--- 52,57 ----
*** ../vim-8.0.0846/src/testdir/test_arglist.vim 2017-07-16
16:42:08.066725876 +0200
--- src/testdir/test_arglist.vim 2017-08-03 14:18:59.312391939 +0200
***************
*** 65,77 ****
%argd
edit d
arga
! call assert_equal(len(argv()), 1)
! call assert_equal(get(argv(), 0, ''), 'd')
%argd
new
arga
! call assert_equal(len(argv()), 0)
endfunc
func Init_abc()
--- 65,83 ----
%argd
edit d
arga
! 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(0, len(argv()))
endfunc
func Init_abc()
*** ../vim-8.0.0846/src/version.c 2017-08-03 13:51:02.388784785 +0200
--- src/version.c 2017-08-03 14:28:42.560097336 +0200
***************
*** 771,772 ****
--- 771,774 ----
{ /* Add new patch number below this line */
+ /**/
+ 847,
/**/
--
A poem: read aloud:
<> !*''# Waka waka bang splat tick tick hash,
^"`$$- Caret quote back-tick dollar dollar dash,
!*=@$_ Bang splat equal at dollar under-score,
%*<> ~#4 Percent splat waka waka tilde number four,
&[]../ Ampersand bracket bracket dot dot slash,
|{,,SYSTEM HALTED Vertical-bar curly-bracket comma comma CRASH.
Fred Bremmer and Steve Kroese (Calvin College & Seminary of Grand Rapids, MI.)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.