1
0
forked from aniani/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 #1681)  Define macros for the return values
            of getfile().
This commit is contained in:
Bram Moolenaar
2017-06-05 16:01:59 +02:00
parent b463e8d999
commit 8ad80dea08
7 changed files with 103 additions and 23 deletions

View File

@@ -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", "",