vim-patch:8.2.2634: 'tagfunc' does not indicate using a pattern

Problem:    'tagfunc' does not indicate using a pattern.
Solution:   Add the "r" flag. (Andy Massimino, closes vim/vim#7982)
f90c855c71
This commit is contained in:
Jan Edmund Lazo
2021-03-21 10:27:59 -04:00
parent 749a8b6be7
commit c620ca4cc2
3 changed files with 27 additions and 8 deletions

View File

@@ -1141,7 +1141,7 @@ static int find_tagfunc_tags(
int result = FAIL;
typval_T args[4];
typval_T rettv;
char_u flagString[3];
char_u flagString[4];
dict_T *d;
taggy_T *tag = &curwin->w_tagstack[curwin->w_tagstackidx];
@@ -1170,9 +1170,10 @@ static int find_tagfunc_tags(
args[3].v_type = VAR_UNKNOWN;
vim_snprintf((char *)flagString, sizeof(flagString),
"%s%s",
"%s%s%s",
g_tag_at_cursor ? "c": "",
flags & TAG_INS_COMP ? "i": "");
flags & TAG_INS_COMP ? "i": "",
flags & TAG_REGEXP ? "r": "");
save_pos = curwin->w_cursor;
result = call_vim_function(curbuf->b_p_tfu, 3, args, &rettv);

View File

@@ -43,12 +43,24 @@ func Test_tagfunc()
call assert_equal('one', g:tagfunc_args[0])
call assert_equal('c', g:tagfunc_args[1])
let g:tagfunc_args=[]
execute "tag /foo$"
call assert_equal('foo$', g:tagfunc_args[0])
call assert_equal('r', g:tagfunc_args[1])
set cpt=t
let g:tagfunc_args=[]
execute "normal! i\<c-n>\<c-y>"
call assert_equal('ci', g:tagfunc_args[1])
call assert_equal('\<\k\k', g:tagfunc_args[0])
call assert_equal('cir', g:tagfunc_args[1])
call assert_equal('nothing1', getline('.')[0:7])
let g:tagfunc_args=[]
execute "normal! ono\<c-n>\<c-n>\<c-y>"
call assert_equal('\<no', g:tagfunc_args[0])
call assert_equal('cir', g:tagfunc_args[1])
call assert_equal('nothing2', getline('.')[0:7])
func BadTagFunc1(...)
return 0
endfunc