summaryrefslogtreecommitdiff
path: root/src/tag.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-10 20:15:15 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-10 20:15:15 +0000
commitf8e9eb8e173bf0ff9560192ae888941ef8302269 (patch)
tree5f3dc3b70e9b43ee7fd4cedead6a2cf5974e0b00 /src/tag.c
parent9fffef9f3562e05755e4b3c46509b2eeeb623ff7 (diff)
downloadvim-git-f8e9eb8e173bf0ff9560192ae888941ef8302269.tar.gz
patch 8.2.3776: when a tags file line is long a tag may not be foundv8.2.3776
Problem: When a tags file line is long a tag may not be found. Solution: When increasing the buffer size read the same line again.
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tag.c b/src/tag.c
index 41d21b751..48a69d466 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -2011,8 +2011,6 @@ find_tags(
eof = vim_fgets(lbuf, lbuf_size, fp);
if (!eof && search_info.curr_offset != 0)
{
- // The explicit cast is to work around a bug in gcc 3.4.2
- // (repeated below).
search_info.curr_offset = vim_ftell(fp);
if (search_info.curr_offset == search_info.high_offset)
{
@@ -2052,7 +2050,10 @@ find_tags(
eof = cs_fgets(lbuf, lbuf_size);
else
#endif
+ {
+ search_info.curr_offset = vim_ftell(fp);
eof = vim_fgets(lbuf, lbuf_size, fp);
+ }
} while (!eof && vim_isblankline(lbuf));
if (eof)
@@ -2294,6 +2295,10 @@ parse_line:
lbuf = alloc(lbuf_size);
if (lbuf == NULL)
goto findtag_end;
+
+ if (state == TS_STEP_FORWARD)
+ // Seek to the same position to read the same line again
+ vim_fseek(fp, search_info.curr_offset, SEEK_SET);
#ifdef FEAT_TAG_BINS
// this will try the same thing again, make sure the offset is
// different