From bf61885cb45fcced4f5886f336460be4af8a8ba8 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 21 Jun 2018 09:59:14 -0400 Subject: vim-patch:8.0.0621: :stag does not respect 'switchbuf' Problem: The ":stag" command does not respect 'switchbuf'. Solution: Check 'switchbuf' for tag commands that may open a new window. (Ingo Karkat, closes vim/vim#1681) Define macros for the return values of getfile(). https://github.com/vim/vim/commit/8ad80dea089ffeb1a845199c013e9bb4be1cd22e --- src/nvim/testdir/test_tagjump.vim | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_tagjump.vim b/src/nvim/testdir/test_tagjump.vim index d5ce193bc6..dbab8d9e26 100644 --- a/src/nvim/testdir/test_tagjump.vim +++ b/src/nvim/testdir/test_tagjump.vim @@ -65,6 +65,48 @@ func Test_duplicate_tagjump() call delete('Xfile1') endfunc +func Test_tagjump_switchbuf() + set tags=Xtags + call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//", + \ "second\tXfile1\t2", + \ "third\tXfile1\t3",], + \ 'Xtags') + call writefile(['first', 'second', 'third'], 'Xfile1') + + enew | only + set switchbuf= + stag second + call assert_equal(2, winnr('$')) + call assert_equal(2, line('.')) + stag third + call assert_equal(3, winnr('$')) + call assert_equal(3, line('.')) + + enew | only + set switchbuf=useopen + stag second + call assert_equal(2, winnr('$')) + call assert_equal(2, line('.')) + stag third + call assert_equal(2, winnr('$')) + call assert_equal(3, line('.')) + + enew | only + set switchbuf=usetab + tab stag second + call assert_equal(2, tabpagenr('$')) + call assert_equal(2, line('.')) + 1tabnext | stag third + call assert_equal(2, tabpagenr('$')) + call assert_equal(3, line('.')) + + tabclose! + enew | only + call delete('Xfile1') + call delete('Xtags') + set switchbuf&vim +endfunc + " Tests for [ CTRL-I and CTRL-W CTRL-I commands function Test_keyword_jump() call writefile(["#include Xinclude", "", -- cgit