To: vim_dev@googlegroups.com Subject: Patch 8.0.0439 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0439 Problem: Using ":%argdel" while the argument list is already empty gives an error. (Pavol Juhas) Solution: Don't give an error. (closes #1546) Files: src/ex_cmds2.c, src/testdir/test_arglist.vim *** ../vim-8.0.0438/src/ex_cmds2.c 2017-02-05 16:07:50.287087674 +0100 --- src/ex_cmds2.c 2017-03-09 15:45:08.882302314 +0100 *************** *** 2832,2839 **** if (eap->line2 > ARGCOUNT) eap->line2 = ARGCOUNT; n = eap->line2 - eap->line1 + 1; ! if (*eap->arg != NUL || n <= 0) EMSG(_(e_invarg)); else { for (i = eap->line1; i <= eap->line2; ++i) --- 2832,2846 ---- if (eap->line2 > ARGCOUNT) eap->line2 = ARGCOUNT; n = eap->line2 - eap->line1 + 1; ! if (*eap->arg != NUL) ! /* Can't have both a range and an argument. */ EMSG(_(e_invarg)); + else if (n <= 0) + { + /* Don't give an error for ":%argdel" if the list is empty. */ + if (eap->line1 != 1 || eap->line2 != 0) + EMSG(_(e_invrange)); + } else { for (i = eap->line1; i <= eap->line2; ++i) *** ../vim-8.0.0438/src/testdir/test_arglist.vim 2016-09-07 20:37:01.000000000 +0200 --- src/testdir/test_arglist.vim 2017-03-09 15:50:26.540057689 +0100 *************** *** 6,11 **** --- 6,15 ---- call assert_equal(2, argidx()) %argdelete call assert_equal(0, argidx()) + " doing it again doesn't result in an error + %argdelete + call assert_equal(0, argidx()) + call assert_fails('2argdelete', 'E16:') args a b c call assert_equal(0, argidx()) *** ../vim-8.0.0438/src/version.c 2017-03-09 14:00:23.630289947 +0100 --- src/version.c 2017-03-09 15:48:59.268674220 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 439, /**/ -- From "know your smileys": :-{} Too much lipstick /// Bram Moolenaar -- Bram@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 ///