summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-15 22:23:37 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-15 22:23:37 +0200
commit27fc8cab227e30f649f52e74efd58ad56d21e9bb (patch)
tree7f6bef8a1eaf00e455ef6cd58d627cbd9b35ca2e
parent3c8cd4a1dcbc34d8818a2a38b1d1e4755da9edc2 (diff)
patch 8.1.2152: problems navigating tags file on MacOS Catalinav8.1.2152
Problem: Problems navigating tags file on MacOS Catalina. Solution: Use fseek instead of lseek. (John Lamb, fixes #5061)
-rw-r--r--src/tag.c24
-rw-r--r--src/version.c2
2 files changed, 14 insertions, 12 deletions
diff --git a/src/tag.c b/src/tag.c
index 284f2c1a02..75ff026c55 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -2198,23 +2198,23 @@ line_read_in:
#endif
#ifdef FEAT_TAG_BINS
- /*
- * When starting a binary search, get the size of the file and
- * compute the first offset.
- */
+ // When starting a binary search, get the size of the file and
+ // compute the first offset.
if (state == TS_BINARY)
{
- /* Get the tag file size (don't use mch_fstat(), it's not
- * portable). */
- if ((filesize = vim_lseek(fileno(fp),
- (off_T)0L, SEEK_END)) <= 0)
+ if (vim_fseek(fp, 0L, SEEK_END) != 0)
+ // can't seek, don't use binary search
state = TS_LINEAR;
else
{
- vim_lseek(fileno(fp), (off_T)0L, SEEK_SET);
-
- /* Calculate the first read offset in the file. Start
- * the search in the middle of the file. */
+ // Get the tag file size (don't use mch_fstat(), it's
+ // not portable). Don't use lseek(), it doesn't work
+ // properly on MacOS Catalina.
+ filesize = vim_ftell(fp);
+ vim_fseek(fp, 0L, SEEK_SET);
+
+ // Calculate the first read offset in the file. Start
+ // the search in the middle of the file.
search_info.low_offset = 0;
search_info.low_char = 0;
search_info.high_offset = filesize;
diff --git a/src/version.c b/src/version.c
index c1c3442164..e21f5c468b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2152,
+/**/
2151,
/**/
2150,