From c620ca4cc2f5c0b3cebde2e172ed1682b06f4495 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 21 Mar 2021 10:27:59 -0400 Subject: 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) https://github.com/vim/vim/commit/f90c855c71863296859780f7b4e0386e96f1c465 --- src/nvim/tag.c | 7 ++++--- src/nvim/testdir/test_tagfunc.vim | 14 +++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 4ea298fba9..8d9ae68985 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -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); diff --git a/src/nvim/testdir/test_tagfunc.vim b/src/nvim/testdir/test_tagfunc.vim index 242aa3a235..bb465bafb7 100644 --- a/src/nvim/testdir/test_tagfunc.vim +++ b/src/nvim/testdir/test_tagfunc.vim @@ -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\\" - 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\\\" + call assert_equal('\