mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
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)
27fc8cab22
This commit is contained in:
@@ -1094,7 +1094,6 @@ find_tags (
|
|||||||
int low_char; // first char at low_offset
|
int low_char; // first char at low_offset
|
||||||
int high_char; // first char at high_offset
|
int high_char; // first char at high_offset
|
||||||
} search_info;
|
} search_info;
|
||||||
off_T filesize;
|
|
||||||
int tagcmp;
|
int tagcmp;
|
||||||
off_T offset;
|
off_T offset;
|
||||||
int round;
|
int round;
|
||||||
@@ -1503,19 +1502,21 @@ line_read_in:
|
|||||||
state = TS_LINEAR;
|
state = TS_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// When starting a binary search, get the size of the file and
|
||||||
* When starting a binary search, get the size of the file and
|
// compute the first offset.
|
||||||
* compute the first offset.
|
|
||||||
*/
|
|
||||||
if (state == TS_BINARY) {
|
if (state == TS_BINARY) {
|
||||||
if (vim_fseek(fp, 0, SEEK_END) != 0) {
|
if (vim_fseek(fp, 0, SEEK_END) != 0) {
|
||||||
|
// can't seek, don't use binary search
|
||||||
state = TS_LINEAR;
|
state = TS_LINEAR;
|
||||||
} else {
|
} 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);
|
vim_fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
/* Calculate the first read offset in the file. Start
|
// Calculate the first read offset in the file. Start
|
||||||
* the search in the middle of the file. */
|
// the search in the middle of the file.
|
||||||
search_info.low_offset = 0;
|
search_info.low_offset = 0;
|
||||||
search_info.low_char = 0;
|
search_info.low_char = 0;
|
||||||
search_info.high_offset = filesize;
|
search_info.high_offset = filesize;
|
||||||
|
Reference in New Issue
Block a user