patch 8.2.4719: ">" marker sometimes not displayed in the jumplist v8.2.4719
authorChristian Brabandt <cb@256bit.org>
Sat, 9 Apr 2022 12:35:00 +0000 (13:35 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 9 Apr 2022 12:35:00 +0000 (13:35 +0100)
Problem:    ">" marker sometimes not displayed in the jumplist.
Solution:   If the buffer no longer exists show "-invalid-". (Christian
            Brabandt, closes #10131, closes #10100)

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 [deleted file]
src/version.c

index 7946a133e8733f473ba93d3cfa80bc6dae5d5d37..ede51125f18b0ee974b3ba375e98fccd25879fbf 100644 (file)
@@ -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:
 
index fbb4b9a4525c7177f9f9f249292f369240325829..e7addbea8e0b55322bdcac409e945f4a78761cbf 100644 (file)
@@ -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))
            {
index ec12b6b4012fa39e9cbb2907899eb64664d84eee..e1a786f29101cfab26c2033f55935ab75810d2a1 100644 (file)
@@ -170,7 +170,6 @@ NEW_TESTS = \
        test_join \
        test_json \
        test_jumplist \
-       test_jumps \
        test_lambda \
        test_langmap \
        test_largefile \
index f54e6f2c509d2a5178d8c2c1849f968cdeb909f0..845c117f65b8bf422659d753920ab9313f30fb1f 100644 (file)
@@ -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
index c838bb95730ca9f3dfb753b7bfe752678e4a6c6a..054fda083be167b0f1ac5723612101bd16bb46ba 100644 (file)
@@ -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 (file)
index 5b46adc..0000000
+++ /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
index f4eb4d14cc99b47b94940fe9d4da40d2a33b6a6c..b71928abdfb2485062f92676c5bdec7af758641c 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4719,
 /**/
     4718,
 /**/