To: vim_dev@googlegroups.com Subject: Patch 7.4.1119 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1119 Problem: argidx() has a wrong value after ":%argdelete". (Yegappan Lakshmanan) Solution: Correct the value of w_arg_idx. Add a test. Files: src/ex_cmds2.c, src/testdir/test_arglist.vim, src/testdir/Make_all.mak *** ../vim-7.4.1118/src/ex_cmds2.c 2016-01-16 22:49:30.707420082 +0100 --- src/ex_cmds2.c 2016-01-17 17:59:17.239828171 +0100 *************** *** 2562,2567 **** --- 2562,2571 ---- curwin->w_arg_idx -= n; else if (curwin->w_arg_idx > eap->line1) curwin->w_arg_idx = eap->line1; + if (ARGCOUNT == 0) + curwin->w_arg_idx = 0; + else if (curwin->w_arg_idx >= ARGCOUNT) + curwin->w_arg_idx = ARGCOUNT - 1; } } else if (*eap->arg == NUL) *** ../vim-7.4.1118/src/testdir/test_arglist.vim 2016-01-17 18:03:57.352803543 +0100 --- src/testdir/test_arglist.vim 2016-01-17 18:00:51.002815509 +0100 *************** *** 0 **** --- 1,22 ---- + " Test argument list commands + + func Test_argidx() + args a b c + last + call assert_equal(2, argidx()) + %argdelete + call assert_equal(0, argidx()) + + args a b c + call assert_equal(0, argidx()) + next + call assert_equal(1, argidx()) + next + call assert_equal(2, argidx()) + 1argdelete + call assert_equal(1, argidx()) + 1argdelete + call assert_equal(0, argidx()) + 1argdelete + call assert_equal(0, argidx()) + endfunc *** ../vim-7.4.1118/src/testdir/Make_all.mak 2016-01-16 22:47:12.820927766 +0100 --- src/testdir/Make_all.mak 2016-01-17 17:56:08.557866676 +0100 *************** *** 171,177 **** # Tests using runtest.vim.vim. # Keep test_alot.res as the last one, sort the others. ! NEW_TESTS = test_assert.res \ test_cdo.res \ test_hardcopy.res \ test_increment.res \ --- 171,178 ---- # Tests using runtest.vim.vim. # Keep test_alot.res as the last one, sort the others. ! NEW_TESTS = test_arglist.res \ ! test_assert.res \ test_cdo.res \ test_hardcopy.res \ test_increment.res \ *** ../vim-7.4.1118/src/version.c 2016-01-17 17:10:54.134874935 +0100 --- src/version.c 2016-01-17 18:01:17.102533666 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 1119, /**/ -- If the Universe is constantly expanding, why can't I ever find a parking space? /// 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 ///