aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-10-15 20:35:47 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-10-18 23:19:54 -0400
commit0e0d4a7b4c0a38c83282013b732c83d82b1844e9 (patch)
tree2e44165bf77f8ebec1318bc2fd39550591010bf5
parent175ca82ca7baec7ce449d9e72f77a8f12d2e50dc (diff)
downloadrneovim-0e0d4a7b4c0a38c83282013b732c83d82b1844e9.tar.gz
rneovim-0e0d4a7b4c0a38c83282013b732c83d82b1844e9.tar.bz2
rneovim-0e0d4a7b4c0a38c83282013b732c83d82b1844e9.zip
vim-patch:8.1.2152: problems navigating tags file on MacOS Catalina
Problem: Problems navigating tags file on MacOS Catalina. Solution: Use fseek instead of lseek. (John Lamb, fixes vim/vim#5061) https://github.com/vim/vim/commit/27fc8cab227e30f649f52e74efd58ad56d21e9bb
-rw-r--r--src/nvim/tag.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 1f70a10f28..c8c9677a98 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1094,7 +1094,6 @@ find_tags (
int low_char; // first char at low_offset
int high_char; // first char at high_offset
} search_info;
- off_T filesize;
int tagcmp;
off_T offset;
int round;
@@ -1503,19 +1502,21 @@ line_read_in:
state = TS_LINEAR;
}
- /*
- * 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) {
if (vim_fseek(fp, 0, SEEK_END) != 0) {
+ // can't seek, don't use binary search
state = TS_LINEAR;
} else {
- filesize = vim_ftell(fp);
+ // Get the tag file size.
+ // Don't use lseek(), it doesn't work
+ // properly on MacOS Catalina.
+ const off_T filesize = vim_ftell(fp);
vim_fseek(fp, 0, SEEK_SET);
- /* Calculate the first read offset in the file. Start
- * the search in the middle of the file. */
+ // 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;