diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-08-17 19:34:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-08-17 19:34:10 +0200 |
commit | 7b22117c4ecf383b6f35acef041773a83ec28220 (patch) | |
tree | 980afe611e35c20ab256b97453d519d60d283f04 /src | |
parent | 241572794f7e93d2f8b762de2300e5f7e4f07628 (diff) | |
download | vim-git-7b22117c4ecf383b6f35acef041773a83ec28220.tar.gz |
patch 8.2.1472: ":argdel" does not work like ":.argdel" as documentedv8.2.1472
Problem: ":argdel" does not work like ":.argdel" as documented. (Alexey
Demin)
Solution: Make ":argdel" work like ":.argdel". (closes #6727)
Also fix giving the error "0 more files to edit".
Diffstat (limited to 'src')
-rw-r--r-- | src/arglist.c | 18 | ||||
-rw-r--r-- | src/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/testdir/test_arglist.vim | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 24 insertions, 8 deletions
diff --git a/src/arglist.c b/src/arglist.c index 8e0f4d2e8..181036760 100644 --- a/src/arglist.c +++ b/src/arglist.c @@ -776,10 +776,20 @@ ex_argdelete(exarg_T *eap) int i; int n; - if (eap->addr_count > 0) + if (eap->addr_count > 0 || *eap->arg == NUL) { - // ":1,4argdel": Delete all arguments in the range. - if (eap->line2 > ARGCOUNT) + // ":argdel" works like ":argdel" + if (eap->addr_count == 0) + { + if (curwin->w_arg_idx >= ARGCOUNT) + { + emsg(_("E610: No argument to delete")); + return; + } + eap->line1 = eap->line2 = curwin->w_arg_idx + 1; + } + else if (eap->line2 > ARGCOUNT) + // ":1,4argdel": Delete all arguments in the range. eap->line2 = ARGCOUNT; n = eap->line2 - eap->line1 + 1; if (*eap->arg != NUL) @@ -808,8 +818,6 @@ ex_argdelete(exarg_T *eap) curwin->w_arg_idx = ARGCOUNT - 1; } } - else if (*eap->arg == NUL) - emsg(_(e_argreq)); else do_arglist(eap->arg, AL_DEL, 0, FALSE); #ifdef FEAT_TITLE diff --git a/src/ex_docmd.c b/src/ex_docmd.c index c08524fff..612d478e9 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -5022,7 +5022,7 @@ check_more( int n = ARGCOUNT - curwin->w_arg_idx - 1; if (!forceit && only_one_window() - && ARGCOUNT > 1 && !arg_had_last && n >= 0 && quitmore == 0) + && ARGCOUNT > 1 && !arg_had_last && n > 0 && quitmore == 0) { if (message) { diff --git a/src/testdir/test_arglist.vim b/src/testdir/test_arglist.vim index 820d8b969..9b23a512e 100644 --- a/src/testdir/test_arglist.vim +++ b/src/testdir/test_arglist.vim @@ -423,9 +423,15 @@ func Test_argdelete() last argdelete % call assert_equal(['b'], argv()) - call assert_fails('argdelete', 'E471:') + call assert_fails('argdelete', 'E610:') call assert_fails('1,100argdelete', 'E16:') - %argd + + call Reset_arglist() + args a b c d + next + argdel + call Assert_argc(['a', 'c', 'd']) + %argdel endfunc func Test_argdelete_completion() diff --git a/src/version.c b/src/version.c index 7e660d8c4..92649a3ec 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1472, +/**/ 1471, /**/ 1470, |