To: vim_dev@googlegroups.com Subject: Patch 8.2.4719 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4719 Problem: ">" marker sometimes not displayed in the jumplist. Solution: If the buffer no longer exists show "-invalid-". (Christian Brabandt, closes #10131, closes #10100) Files: runtime/doc/motion.txt, src/mark.c, src/testdir/Make_all.mak, src/testdir/test_alot.vim, src/testdir/test_jumplist.vim, src/testdir/test_jumps.vim *** ../vim-8.2.4718/runtime/doc/motion.txt 2021-12-13 13:11:00.688262353 +0000 --- runtime/doc/motion.txt 2022-04-09 13:28:30.612801615 +0100 *************** *** 1065,1078 **** in the current file (an indent is removed and a long line is truncated to fit in the window). You are currently in line 1167. If you then use the CTRL-O command, the cursor is put in line 1154. This results in: ! jump line col file/text ~ ! 2 1 0 some text ~ ! 1 70 0 another line ~ ! > 0 1154 23 end. ~ ! 1 1167 0 foo bar ~ The pointer will be set at the last used jump position. The next CTRL-O command will use the entry above it, the next CTRL-I command will use the --- 1077,1093 ---- in the current file (an indent is removed and a long line is truncated to fit in the window). + The marker ">" indicates the current position in the jumplist. It may not be + shown when filtering the |:jump| command using |:filter| + You are currently in line 1167. If you then use the CTRL-O command, the cursor is put in line 1154. This results in: ! jump line col file/text ~ ! 2 1 0 some text ~ ! 1 70 0 another line ~ ! > 0 1154 23 end. ~ ! 1 1167 0 foo bar ~ The pointer will be set at the last used jump position. The next CTRL-O command will use the entry above it, the next CTRL-I command will use the *************** *** 1099,1110 **** After the CTRL-O command that got you into line 1154 you could give another jump command (e.g., "G"). The jump list would then become: ! jump line col file/text ~ ! 4 1 0 some text ~ ! 3 70 0 another line ~ ! 2 1167 0 foo bar ~ ! 1 1154 23 end. ~ ! > ~ The line numbers will be adjusted for deleted and inserted lines. This fails if you stop editing a file without writing, like with ":n!". --- 1114,1125 ---- After the CTRL-O command that got you into line 1154 you could give another jump command (e.g., "G"). The jump list would then become: ! jump line col file/text ~ ! 4 1 0 some text ~ ! 3 70 0 another line ~ ! 2 1167 0 foo bar ~ ! 1 1154 23 end. ~ ! > ~ The line numbers will be adjusted for deleted and inserted lines. This fails if you stop editing a file without writing, like with ":n!". *** ../vim-8.2.4718/src/mark.c 2022-03-30 10:57:36.731346204 +0100 --- src/mark.c 2022-04-09 13:30:04.528692064 +0100 *************** *** 871,876 **** --- 871,880 ---- { name = fm_getname(&curwin->w_jumplist[i].fmark, 16); + // Make sure to output the current indicator, even when on an wiped + // out buffer. ":filter" may still skip it. + if (name == NULL && i == curwin->w_jumplistidx) + name = vim_strsave((char_u *)"-invalid-"); // apply :filter /pat/ or file name not available if (name == NULL || message_filtered(name)) { *** ../vim-8.2.4718/src/testdir/Make_all.mak 2022-01-07 21:38:43.175435880 +0000 --- src/testdir/Make_all.mak 2022-04-09 13:25:14.877028158 +0100 *************** *** 170,176 **** test_join \ test_json \ test_jumplist \ - test_jumps \ test_lambda \ test_langmap \ test_largefile \ --- 170,175 ---- *** ../vim-8.2.4718/src/testdir/test_alot.vim 2021-03-10 20:55:42.729459602 +0000 --- src/testdir/test_alot.vim 2022-04-09 13:25:14.877028158 +0100 *************** *** 17,23 **** source test_ga.vim source test_glob2regpat.vim source test_global.vim - source test_jumps.vim source test_lispwords.vim source test_move.vim source test_put.vim --- 17,22 ---- *** ../vim-8.2.4718/src/testdir/test_jumplist.vim 2021-12-13 13:11:00.696262332 +0000 --- src/testdir/test_jumplist.vim 2022-04-09 13:25:14.877028158 +0100 *************** *** 61,64 **** --- 61,103 ---- call delete("Xtest") endfunc + func Test_jumplist_invalid() + new + clearjumps + " put some randome text + put ='a' + let prev = bufnr('%') + setl nomodified bufhidden=wipe + e XXJumpListBuffer + let bnr = bufnr('%') + " 1) empty jumplist + let expected = [[ + \ {'lnum': 2, 'bufnr': prev, 'col': 0, 'coladd': 0}], 1] + call assert_equal(expected, getjumplist()) + let jumps = execute(':jumps') + call assert_equal('>', jumps[-1:]) + " now jump back + exe ":norm! \" + let expected = [[ + \ {'lnum': 2, 'bufnr': prev, 'col': 0, 'coladd': 0}, + \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 0] + call assert_equal(expected, getjumplist()) + let jumps = execute(':jumps') + call assert_match('> 0 2 0 -invalid-', jumps) + endfunc + + " Test for '' mark in an empty buffer + + func Test_empty_buffer() + new + insert + a + b + c + d + . + call assert_equal(1, line("''")) + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4718/src/testdir/test_jumps.vim 2020-08-12 17:50:31.879655802 +0100 --- src/testdir/test_jumps.vim 1970-01-01 00:00:00.000000000 +0000 *************** *** 1,15 **** - " Test for '' mark in an empty buffer - - func Test_empty_buffer() - new - insert - a - b - c - d - . - call assert_equal(1, line("''")) - bwipe! - endfunc - - " vim: shiftwidth=2 sts=2 expandtab --- 0 ---- *** ../vim-8.2.4718/src/version.c 2022-04-09 12:39:51.563956636 +0100 --- src/version.c 2022-04-09 13:26:54.344913373 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4719, /**/ -- It might look like I'm doing nothing, but at the cellular level I'm really quite busy. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///