Mercurial > vim
comparison src/tag.c @ 26492:08e3eee541ac v8.2.3776
patch 8.2.3776: when a tags file line is long a tag may not be found
Commit: https://github.com/vim/vim/commit/f8e9eb8e173bf0ff9560192ae888941ef8302269
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 10 20:15:15 2021 +0000
patch 8.2.3776: when a tags file line is long a tag may not be found
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 10 Dec 2021 21:30:03 +0100 |
parents | 65b4109a4297 |
children | 13ba00ef7687 |
comparison
equal
deleted
inserted
replaced
26491:653b058ee612 | 26492:08e3eee541ac |
---|---|
2009 search_info.curr_offset_used = search_info.curr_offset; | 2009 search_info.curr_offset_used = search_info.curr_offset; |
2010 vim_fseek(fp, search_info.curr_offset, SEEK_SET); | 2010 vim_fseek(fp, search_info.curr_offset, SEEK_SET); |
2011 eof = vim_fgets(lbuf, lbuf_size, fp); | 2011 eof = vim_fgets(lbuf, lbuf_size, fp); |
2012 if (!eof && search_info.curr_offset != 0) | 2012 if (!eof && search_info.curr_offset != 0) |
2013 { | 2013 { |
2014 // The explicit cast is to work around a bug in gcc 3.4.2 | |
2015 // (repeated below). | |
2016 search_info.curr_offset = vim_ftell(fp); | 2014 search_info.curr_offset = vim_ftell(fp); |
2017 if (search_info.curr_offset == search_info.high_offset) | 2015 if (search_info.curr_offset == search_info.high_offset) |
2018 { | 2016 { |
2019 // oops, gone a bit too far; try from low offset | 2017 // oops, gone a bit too far; try from low offset |
2020 vim_fseek(fp, search_info.low_offset, SEEK_SET); | 2018 vim_fseek(fp, search_info.low_offset, SEEK_SET); |
2050 #ifdef FEAT_CSCOPE | 2048 #ifdef FEAT_CSCOPE |
2051 if (use_cscope) | 2049 if (use_cscope) |
2052 eof = cs_fgets(lbuf, lbuf_size); | 2050 eof = cs_fgets(lbuf, lbuf_size); |
2053 else | 2051 else |
2054 #endif | 2052 #endif |
2053 { | |
2054 search_info.curr_offset = vim_ftell(fp); | |
2055 eof = vim_fgets(lbuf, lbuf_size, fp); | 2055 eof = vim_fgets(lbuf, lbuf_size, fp); |
2056 } | |
2056 } while (!eof && vim_isblankline(lbuf)); | 2057 } while (!eof && vim_isblankline(lbuf)); |
2057 | 2058 |
2058 if (eof) | 2059 if (eof) |
2059 { | 2060 { |
2060 #ifdef FEAT_EMACS_TAGS | 2061 #ifdef FEAT_EMACS_TAGS |
2292 lbuf_size *= 2; | 2293 lbuf_size *= 2; |
2293 vim_free(lbuf); | 2294 vim_free(lbuf); |
2294 lbuf = alloc(lbuf_size); | 2295 lbuf = alloc(lbuf_size); |
2295 if (lbuf == NULL) | 2296 if (lbuf == NULL) |
2296 goto findtag_end; | 2297 goto findtag_end; |
2298 | |
2299 if (state == TS_STEP_FORWARD) | |
2300 // Seek to the same position to read the same line again | |
2301 vim_fseek(fp, search_info.curr_offset, SEEK_SET); | |
2297 #ifdef FEAT_TAG_BINS | 2302 #ifdef FEAT_TAG_BINS |
2298 // this will try the same thing again, make sure the offset is | 2303 // this will try the same thing again, make sure the offset is |
2299 // different | 2304 // different |
2300 search_info.curr_offset = 0; | 2305 search_info.curr_offset = 0; |
2301 #endif | 2306 #endif |