Skip to content

Commit

Permalink
patch 9.1.0428: Tag guessing leaves wrong search history with very sh…
Browse files Browse the repository at this point in the history
…ort names

Problem:  Tag guessing leaves wrong search history with very short names
          (after 9.1.0426).
Solution: Use the correct variable for pattern length (zeertzjq).

closes: #14817

Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
zeertzjq authored and chrisbra committed May 21, 2024
1 parent ffed154 commit 42cd192
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -3945,7 +3945,7 @@ jumpto_tag(
// Guess again: "^char * \<func ("
pbuflen = vim_snprintf((char *)pbuf, LSIZE, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
tagp.tagname);
if (!do_search(NULL, '/', '/', pbuf, len, (long)1,
if (!do_search(NULL, '/', '/', pbuf, pbuflen, (long)1,
search_options, NULL))
found = 0;
}
Expand Down
18 changes: 18 additions & 0 deletions src/testdir/test_tagjump.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1560,4 +1560,22 @@ func Test_tagbsearch()
set tags& tagbsearch&
endfunc

" Test tag guessing with very short names
func Test_tag_guess_short()
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "y\tXf\t/^y()/"],
\ 'Xt', 'D')
set tags=Xt cpoptions+=t
call writefile(['', 'int * y () {}', ''], 'Xf', 'D')

let v:statusmsg = ''
let @/ = ''
ta y
call assert_match('E435:', v:statusmsg)
call assert_equal(2, line('.'))
call assert_match('<y', @/)

set tags& cpoptions-=t
endfunc

" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
428,
/**/
427,
/**/
Expand Down

0 comments on commit 42cd192

Please sign in to comment.