patch 8.1.1087: tag stack is incorrect after CTRL-T and then :tag
Problem: tag stack is incorrect after CTRL-T and then :tag Solution: Handle DT_TAG differently. (test by Andy Massimino, closes #3944, closes #4177)
This commit is contained in:
@ -504,13 +504,16 @@ do_tag(
|
|||||||
tagmatchname = vim_strsave(name);
|
tagmatchname = vim_strsave(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == DT_TAG || type == DT_SELECT || type == DT_JUMP
|
if (type == DT_SELECT || type == DT_JUMP
|
||||||
#if defined(FEAT_QUICKFIX)
|
#if defined(FEAT_QUICKFIX)
|
||||||
|| type == DT_LTAG
|
|| type == DT_LTAG
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
cur_match = MAXCOL - 1;
|
cur_match = MAXCOL - 1;
|
||||||
max_num_matches = cur_match + 1;
|
if (type == DT_TAG)
|
||||||
|
max_num_matches = MAXCOL;
|
||||||
|
else
|
||||||
|
max_num_matches = cur_match + 1;
|
||||||
|
|
||||||
/* when the argument starts with '/', use it as a regexp */
|
/* when the argument starts with '/', use it as a regexp */
|
||||||
if (!no_regexp && *name == '/')
|
if (!no_regexp && *name == '/')
|
||||||
@ -583,7 +586,7 @@ do_tag(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (type == DT_TAG)
|
if (type == DT_TAG && *tag != NUL)
|
||||||
/*
|
/*
|
||||||
* If a count is supplied to the ":tag <name>" command, then
|
* If a count is supplied to the ":tag <name>" command, then
|
||||||
* jump to count'th matching tag.
|
* jump to count'th matching tag.
|
||||||
|
|||||||
@ -366,4 +366,77 @@ func Test_getsettagstack()
|
|||||||
set tags&
|
set tags&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_tag_with_count()
|
||||||
|
call writefile([
|
||||||
|
\ 'test Xtest.h /^void test();$/;" p typeref:typename:void signature:()',
|
||||||
|
\ ], 'Xtags')
|
||||||
|
call writefile([
|
||||||
|
\ 'main Xtest.c /^int main()$/;" f typeref:typename:int signature:()',
|
||||||
|
\ 'test Xtest.c /^void test()$/;" f typeref:typename:void signature:()',
|
||||||
|
\ ], 'Ytags')
|
||||||
|
cal writefile([
|
||||||
|
\ 'int main()',
|
||||||
|
\ 'void test()',
|
||||||
|
\ ], 'Xtest.c')
|
||||||
|
cal writefile([
|
||||||
|
\ 'void test();',
|
||||||
|
\ ], 'Xtest.h')
|
||||||
|
set tags=Xtags,Ytags
|
||||||
|
|
||||||
|
new Xtest.c
|
||||||
|
let tl = taglist('test', 'Xtest.c')
|
||||||
|
call assert_equal(tl[0].filename, 'Xtest.c')
|
||||||
|
call assert_equal(tl[1].filename, 'Xtest.h')
|
||||||
|
|
||||||
|
tag test
|
||||||
|
call assert_equal(bufname('%'), 'Xtest.c')
|
||||||
|
1tag test
|
||||||
|
call assert_equal(bufname('%'), 'Xtest.c')
|
||||||
|
2tag test
|
||||||
|
call assert_equal(bufname('%'), 'Xtest.h')
|
||||||
|
|
||||||
|
set tags&
|
||||||
|
call delete('Xtags')
|
||||||
|
call delete('Ytags')
|
||||||
|
bwipe Xtest.h
|
||||||
|
bwipe Xtest.c
|
||||||
|
call delete('Xtest.h')
|
||||||
|
call delete('Xtest.c')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_tagnr_recall()
|
||||||
|
call writefile([
|
||||||
|
\ 'test Xtest.h /^void test();$/;" p',
|
||||||
|
\ 'main Xtest.c /^int main()$/;" f',
|
||||||
|
\ 'test Xtest.c /^void test()$/;" f',
|
||||||
|
\ ], 'Xtags')
|
||||||
|
cal writefile([
|
||||||
|
\ 'int main()',
|
||||||
|
\ 'void test()',
|
||||||
|
\ ], 'Xtest.c')
|
||||||
|
cal writefile([
|
||||||
|
\ 'void test();',
|
||||||
|
\ ], 'Xtest.h')
|
||||||
|
set tags=Xtags
|
||||||
|
|
||||||
|
new Xtest.c
|
||||||
|
let tl = taglist('test', 'Xtest.c')
|
||||||
|
call assert_equal(tl[0].filename, 'Xtest.c')
|
||||||
|
call assert_equal(tl[1].filename, 'Xtest.h')
|
||||||
|
|
||||||
|
2tag test
|
||||||
|
call assert_equal(bufname('%'), 'Xtest.h')
|
||||||
|
pop
|
||||||
|
call assert_equal(bufname('%'), 'Xtest.c')
|
||||||
|
tag
|
||||||
|
call assert_equal(bufname('%'), 'Xtest.h')
|
||||||
|
|
||||||
|
set tag&
|
||||||
|
call delete('Xtags')
|
||||||
|
bwipe Xtest.h
|
||||||
|
bwipe Xtest.c
|
||||||
|
call delete('Xtest.h')
|
||||||
|
call delete('Xtest.c')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@ -775,6 +775,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1087,
|
||||||
/**/
|
/**/
|
||||||
1086,
|
1086,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user