Patch 8.2.1472

2 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 17, 2020, 1:35:32 PM8/17/20
to vim...@googlegroups.com

Patch 8.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".
Files: src/arglist.c, src/ex_docmd.c, src/testdir/test_arglist.vim


*** ../vim-8.2.1471/src/arglist.c 2020-04-02 18:50:42.411773160 +0200
--- src/arglist.c 2020-08-17 19:26:26.608657764 +0200
***************
*** 776,785 ****
int i;
int n;

! if (eap->addr_count > 0)
{
! // ":1,4argdel": Delete all arguments in the range.
! if (eap->line2 > ARGCOUNT)
eap->line2 = ARGCOUNT;
n = eap->line2 - eap->line1 + 1;
if (*eap->arg != NUL)
--- 776,795 ----
int i;
int n;

! if (eap->addr_count > 0 || *eap->arg == NUL)
{
! // ":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,815 ****
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
--- 818,823 ----
*** ../vim-8.2.1471/src/ex_docmd.c 2020-08-15 16:33:24.497747330 +0200
--- src/ex_docmd.c 2020-08-17 19:10:06.351494499 +0200
***************
*** 5022,5028 ****
int n = ARGCOUNT - curwin->w_arg_idx - 1;

if (!forceit && only_one_window()
! && ARGCOUNT > 1 && !arg_had_last && n >= 0 && quitmore == 0)
{
if (message)
{
--- 5022,5028 ----
int n = ARGCOUNT - curwin->w_arg_idx - 1;

if (!forceit && only_one_window()
! && ARGCOUNT > 1 && !arg_had_last && n > 0 && quitmore == 0)
{
if (message)
{
*** ../vim-8.2.1471/src/testdir/test_arglist.vim 2020-08-12 18:50:31.871655841 +0200
--- src/testdir/test_arglist.vim 2020-08-17 19:28:38.783731383 +0200
***************
*** 423,431 ****
last
argdelete %
call assert_equal(['b'], argv())
! call assert_fails('argdelete', 'E471:')
call assert_fails('1,100argdelete', 'E16:')
! %argd
endfunc

func Test_argdelete_completion()
--- 423,437 ----
last
argdelete %
call assert_equal(['b'], argv())
! call assert_fails('argdelete', 'E610:')
call assert_fails('1,100argdelete', 'E16:')
!
! call Reset_arglist()
! args a b c d
! next
! argdel
! call Assert_argc(['a', 'c', 'd'])
! %argdel
endfunc

func Test_argdelete_completion()
*** ../vim-8.2.1471/src/version.c 2020-08-16 22:49:57.393356184 +0200
--- src/version.c 2020-08-17 19:33:46.373571764 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1472,
/**/

--
If evolution theories are correct, humans will soon grow a third
hand for operating the mouse.

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages