Mercurial > vim
diff src/testdir/test_tagjump.vim @ 19033:f0312cf3c792 v8.2.0077
patch 8.2.0077: settagstack() cannot truncate at current index
Commit: https://github.com/vim/vim/commit/271fa08a35b8d320d3a40db4ddae83b698fdd4fb
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 2 14:02:16 2020 +0100
patch 8.2.0077: settagstack() cannot truncate at current index
Problem: settagstack() cannot truncate at current index.
Solution: Add the "t" action. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5417)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 02 Jan 2020 14:15:05 +0100 |
parents | 068337e86133 |
children | 8645b73b3645 |
line wrap: on
line diff
--- 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",