diff options
author | Christian Brabandt <cb@256bit.org> | 2022-04-09 13:35:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-09 13:35:00 +0100 |
commit | a0f659c76e22108880f857b8961422afc5ed8f5d (patch) | |
tree | 481ee25dadf487548d286d3b61732ec6c22d19cf | |
parent | cee9c844f27bceaba90362a3fa27a04d4d06c0fd (diff) |
patch 8.2.4719: ">" marker sometimes not displayed in the jumplistv8.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)
-rw-r--r-- | runtime/doc/motion.txt | 3 | ||||
-rw-r--r-- | src/mark.c | 4 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 1 | ||||
-rw-r--r-- | src/testdir/test_alot.vim | 1 | ||||
-rw-r--r-- | src/testdir/test_jumplist.vim | 39 | ||||
-rw-r--r-- | src/testdir/test_jumps.vim | 15 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 48 insertions, 17 deletions
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 7946a133e8..ede51125f1 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -1077,6 +1077,9 @@ The "file/text" column shows the file name, or the text at the jump if it is 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: diff --git a/src/mark.c b/src/mark.c index fbb4b9a452..e7addbea8e 100644 --- a/src/mark.c +++ b/src/mark.c @@ -871,6 +871,10 @@ ex_jumps(exarg_T *eap UNUSED) { 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)) { diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index ec12b6b401..e1a786f291 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -170,7 +170,6 @@ NEW_TESTS = \ test_join \ test_json \ test_jumplist \ - test_jumps \ test_lambda \ test_langmap \ test_largefile \ diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index f54e6f2c50..845c117f65 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -17,7 +17,6 @@ source test_fnamemodify.vim 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 diff --git a/src/testdir/test_jumplist.vim b/src/testdir/test_jumplist.vim index c838bb9573..054fda083b 100644 --- a/src/testdir/test_jumplist.vim +++ b/src/testdir/test_jumplist.vim @@ -61,4 +61,43 @@ func Test_getjumplist() 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! \<c-o>" + 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 diff --git a/src/testdir/test_jumps.vim b/src/testdir/test_jumps.vim deleted file mode 100644 index 5b46adc47e..0000000000 --- a/src/testdir/test_jumps.vim +++ /dev/null @@ -1,15 +0,0 @@ -" 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 diff --git a/src/version.c b/src/version.c index f4eb4d14cc..b71928abdf 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4719, +/**/ 4718, /**/ 4717, |