summaryrefslogtreecommitdiff
path: root/src/testdir/test_tagjump.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-02 14:02:16 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-02 14:02:16 +0100
commit271fa08a35b8d320d3a40db4ddae83b698fdd4fb (patch)
tree4c20c4317f691299e8364f415204e00a85e710c4 /src/testdir/test_tagjump.vim
parent955f4e6f36ea009b90803d12a62108c94f446778 (diff)
downloadvim-git-271fa08a35b8d320d3a40db4ddae83b698fdd4fb.tar.gz
patch 8.2.0077: settagstack() cannot truncate at current indexv8.2.0077
Problem: settagstack() cannot truncate at current index. Solution: Add the "t" action. (Yegappan Lakshmanan, closes #5417)
Diffstat (limited to 'src/testdir/test_tagjump.vim')
-rw-r--r--src/testdir/test_tagjump.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 14ba1f78d..8d32883da 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -348,6 +348,28 @@ func Test_getsettagstack()
\ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 'a')
call assert_equal('abc', gettagstack().items[19].tagname)
+ " truncate the tag stack
+ call settagstack(1,
+ \ {'curidx' : 9,
+ \ 'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')
+ let t = gettagstack()
+ call assert_equal(9, t.length)
+ call assert_equal(10, t.curidx)
+
+ " truncate the tag stack without pushing any new items
+ call settagstack(1, {'curidx' : 5}, 't')
+ let t = gettagstack()
+ call assert_equal(4, t.length)
+ call assert_equal(5, t.curidx)
+
+ " truncate an empty tag stack and push new items
+ call settagstack(1, {'items' : []})
+ call settagstack(1,
+ \ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')
+ let t = gettagstack()
+ call assert_equal(1, t.length)
+ call assert_equal(2, t.curidx)
+
" Tag with multiple matches
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "two\tXfile1\t1",