To: vim_dev@googlegroups.com Subject: Patch 8.1.0901 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0901 Problem: Index in getjumplist() may be wrong. (Epheien) Solution: Call cleanup_jumplist() earlier. (Yegappan Lakshmanan, closes #3942) Files: src/evalfunc.c, src/testdir/test_jumplist.vim *** ../vim-8.1.0900/src/evalfunc.c 2019-02-11 22:00:07.667917634 +0100 --- src/evalfunc.c 2019-02-12 22:06:11.676133841 +0100 *************** *** 5271,5276 **** --- 5271,5278 ---- if (wp == NULL) return; + cleanup_jumplist(wp, TRUE); + l = list_alloc(); if (l == NULL) return; *************** *** 5279,5286 **** return; list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx); - cleanup_jumplist(wp, TRUE); - for (i = 0; i < wp->w_jumplistlen; ++i) { if (wp->w_jumplist[i].fmark.mark.lnum == 0) --- 5281,5286 ---- *** ../vim-8.1.0900/src/testdir/test_jumplist.vim 2018-02-11 14:25:08.000000000 +0100 --- src/testdir/test_jumplist.vim 2019-02-12 22:08:59.458924694 +0100 *************** *** 28,38 **** normal G normal gg ! call assert_equal([[ \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, ! \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4], ! \ getjumplist()) " Traverse the jump list and verify the results 5 --- 28,40 ---- normal G normal gg ! let expected = [[ \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, ! \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 3] ! call assert_equal(expected, getjumplist()) ! " jumplist doesn't change in between calls ! call assert_equal(expected, getjumplist()) " Traverse the jump list and verify the results 5 *************** *** 44,55 **** call assert_equal(3, getjumplist()[1]) exe "normal \" normal 20% ! call assert_equal([[ \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0}, ! \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 5], ! \ getjumplist()) let l = getjumplist() call test_garbagecollect_now() --- 46,59 ---- call assert_equal(3, getjumplist()[1]) exe "normal \" normal 20% ! let expected = [[ \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0}, ! \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4] ! call assert_equal(expected, getjumplist()) ! " jumplist doesn't change in between calls ! call assert_equal(expected, getjumplist()) let l = getjumplist() call test_garbagecollect_now() *** ../vim-8.1.0900/src/version.c 2019-02-12 21:46:43.157342193 +0100 --- src/version.c 2019-02-12 22:14:55.153310642 +0100 *************** *** 785,786 **** --- 785,788 ---- { /* Add new patch number below this line */ + /**/ + 901, /**/ -- The most powerful force in the universe is gossip. /// 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 ///