summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-23 23:02:34 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-23 23:02:34 +0100
commit2faa29f896252073b53f387406109e331fbbe5f8 (patch)
treeb6a11b3de6950ea9c623656b0a5765173026f281 /src
parentbd4593ffb170230504500ddedabad3fad1f31291 (diff)
downloadvim-2faa29f896252073b53f387406109e331fbbe5f8.zip
patch 7.4.1161
Problem: ":argadd" without argument is supposed to add the current buffer name to the arglist. Solution: Make it work as documented. (Coot, closes #577)
Diffstat (limited to 'src')
-rw-r--r--src/ex_cmds.h2
-rw-r--r--src/ex_cmds2.c10
-rw-r--r--src/testdir/test_arglist.vim11
-rw-r--r--src/version.c2
4 files changed, 24 insertions, 1 deletions
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 4b5f68453..78c0afa63 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -128,7 +128,7 @@ EX(CMD_args, "args", ex_args,
BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
ADDR_LINES),
EX(CMD_argadd, "argadd", ex_argadd,
- BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR,
+ BANG|RANGE|NOTADR|ZEROR|FILES|TRLBAR,
ADDR_ARGUMENTS),
EX(CMD_argdelete, "argdelete", ex_argdelete,
BANG|RANGE|NOTADR|FILES|TRLBAR,
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 59bf94589..bc7193d12 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -2090,6 +2090,16 @@ do_arglist(str, what, after)
#endif
/*
+ * Set default argument for ":argadd" command.
+ */
+ if (what == AL_ADD && *str == NUL)
+ {
+ 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)
diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim
index 281ac7ad4..424434427 100644
--- a/src/testdir/test_arglist.vim
+++ b/src/testdir/test_arglist.vim
@@ -57,6 +57,17 @@ func Test_argadd()
+2argadd y
call Assert_argc(['a', 'b', 'c', 'x', 'y'])
call assert_equal(1, argidx())
+
+ %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()
diff --git a/src/version.c b/src/version.c
index 25ba3b97d..ca83550cd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1161,
+/**/
1160,
/**/
1159,