summaryrefslogtreecommitdiff
path: root/src/tag.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-17 16:18:31 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-17 16:18:31 +0100
commit077b9dd3541339a23ade0cc6a23e804ee39312c5 (patch)
tree68415a0f96988c2d833ee9b5e414be9dc8ab9bc4 /src/tag.c
parent09c6f265b21065ffa9437837b1d0955137175e45 (diff)
downloadvim-git-077b9dd3541339a23ade0cc6a23e804ee39312c5.tar.gz
patch 8.1.2312: "line:" field in tags file not usedv8.1.2312
Problem: "line:" field in tags file not used. Solution: Recognize the field and use the value. (Andy Massimino, Daniel Hahler, closes #5232, closes #2546, closes #1057)
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tag.c b/src/tag.c
index e3ad61663..b72d82bf5 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -35,6 +35,7 @@ typedef struct tag_pointers
char_u *tagkind_end; // end of tagkind
char_u *user_data; // user_data string
char_u *user_data_end; // end of user_data
+ linenr_T tagline; // "line:" value
} tagptrs_T;
/*
@@ -3217,6 +3218,7 @@ parse_match(
tagp->tagkind = NULL;
tagp->user_data = NULL;
+ tagp->tagline = 0;
tagp->command_end = NULL;
if (retval == OK)
@@ -3237,6 +3239,8 @@ parse_match(
tagp->tagkind = p + 5;
else if (STRNCMP(p, "user_data:", 10) == 0)
tagp->user_data = p + 10;
+ else if (STRNCMP(p, "line:", 5) == 0)
+ tagp->tagline = atoi((char *)p + 5);
if (tagp->tagkind != NULL && tagp->user_data != NULL)
break;
pc = vim_strchr(p, ':');
@@ -3537,7 +3541,12 @@ jumpto_tag(
p_ic = FALSE; /* don't ignore case now */
p_scs = FALSE;
save_lnum = curwin->w_cursor.lnum;
- curwin->w_cursor.lnum = 0; /* start search before first line */
+ if (tagp.tagline > 0)
+ // start search before line from "line:" field
+ curwin->w_cursor.lnum = tagp.tagline - 1;
+ else
+ // start search before first line
+ curwin->w_cursor.lnum = 0;
if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
search_options, NULL))
retval = OK;