Patch 8.0.0195 (after 8.0.0190)
Summary: fail to jump to static tag in current file
Problem: Jumping to a tag that is a static item in the current file fails.
(Kazunobu Kuriyama)
Solution: Make sure the first byte of the tag key is not NUL. (Suggested by
James McCoy, closes #1387)
Files: src/tag.c, src/testdir/test_tagjump.vim
*** ../vim-8.0.0194/src/tag.c 2017-01-15 16:52:47.226488764 +0100
--- src/tag.c 2017-01-16 20:47:10.965107866 +0100
***************
*** 44,53 ****
#define MT_GL_CUR 1 /* global match in current file */
#define MT_GL_OTH 2 /* global match in other file */
#define MT_ST_OTH 3 /* static match in other file */
- #define MT_IC_ST_CUR 4 /* icase static match in current file */
- #define MT_IC_GL_CUR 5 /* icase global match in current file */
- #define MT_IC_GL_OTH 6 /* icase global match in other file */
- #define MT_IC_ST_OTH 7 /* icase static match in other file */
#define MT_IC_OFF 4 /* add for icase match */
#define MT_RE_OFF 8 /* add for regexp match */
#define MT_MASK 7 /* mask for printing priority */
--- 44,49 ----
***************
*** 2317,2323 ****
if (tagp.command + 2 < temp_end)
{
len = (int)(temp_end - tagp.command - 2);
! mfp = (char_u *)alloc((int)sizeof(char_u) + len +
1);
if (mfp != NULL)
vim_strncpy(mfp, tagp.command + 2, len);
}
--- 2313,2319 ----
if (tagp.command + 2 < temp_end)
{
len = (int)(temp_end - tagp.command - 2);
! mfp = (char_u *)alloc(len + 2);
if (mfp != NULL)
vim_strncpy(mfp, tagp.command + 2, len);
}
***************
*** 2351,2356 ****
--- 2347,2353 ----
* Emacs tag: <mtt><tag_fname><0x01><ebuf><0x01><lbuf><NUL>
* other tag: <mtt><tag_fname><0x01><0x01><lbuf><NUL>
* without Emacs tags: <mtt><tag_fname><0x01><lbuf><NUL>
+ * Here <mtt> is the "mtt" value plus 1 to avoid NUL.
*/
len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3;
#ifdef FEAT_EMACS_TAGS
***************
*** 2366,2372 ****
if (mfp != NULL)
{
p = mfp;
! p[0] = mtt;
STRCPY(p + 1, tag_fname);
#ifdef BACKSLASH_IN_FILENAME
/* Ignore differences in slashes, avoid adding
--- 2363,2369 ----
if (mfp != NULL)
{
p = mfp;
! p[0] = mtt + 1;
STRCPY(p + 1, tag_fname);
#ifdef BACKSLASH_IN_FILENAME
/* Ignore differences in slashes, avoid adding
***************
*** 2548,2557 ****
vim_free(mfp);
else
{
! /* now change the TAG_SEP back to NUL */
! for (p = mfp; *p != NUL; ++p)
! if (*p == TAG_SEP)
! *p = NUL;
matches[match_count++] = (char_u *)mfp;
}
todo--;
--- 2545,2560 ----
vim_free(mfp);
else
{
! if (!name_only)
! {
! /* Change mtt back to zero-based. */
! *mfp = *mfp - 1;
!
! /* change the TAG_SEP back to NUL */
! for (p = mfp + 1; *p != NUL; ++p)
! if (*p == TAG_SEP)
! *p = NUL;
! }
matches[match_count++] = (char_u *)mfp;
}
todo--;
*** ../vim-8.0.0194/src/testdir/test_tagjump.vim 2016-09-07
20:37:01.000000000 +0200
--- src/testdir/test_tagjump.vim 2017-01-16 20:42:11.919082134 +0100
***************
*** 23,28 ****
--- 23,46 ----
quit
endfunc
+ func Test_static_tagjump()
+ set tags=Xtags
+ call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
+ \ "one\tXfile1\t/^one/;\"\tf\tfile:\tsignature:(void)",
+ \ "word\tXfile2\tcmd2"],
+ \ 'Xtags')
+ new Xfile1
+ call setline(1, ['empty', 'one()', 'empty'])
+ write
+ tag one
+ call assert_equal(2, line('.'))
+
+ set tags&
+ call delete('Xtags')
+ call delete('Xfile1')
+ bwipe!
+ endfunc
+
" Tests for [ CTRL-I and CTRL-W CTRL-I commands
function Test_keyword_jump()
call writefile(["#include Xinclude", "",
*** ../vim-8.0.0194/src/version.c 2017-01-15 21:12:44.604730821 +0100
--- src/version.c 2017-01-16 20:51:15.235496124 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 195,
/**/
--
Facepalm statement #5: "Petrol getting more expensive? Not for me, I'm always
tanking for 20 dollars"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.