mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
Merge pull request #8769 from janlazo/vim-8.0.1502
[RDY] vim-patch:8.0.{1502,1512,1622}
This commit is contained in:
@@ -4420,7 +4420,7 @@ do_arg_all (
|
|||||||
if (i < alist->al_ga.ga_len
|
if (i < alist->al_ga.ga_len
|
||||||
&& (AARGLIST(alist)[i].ae_fnum == buf->b_fnum
|
&& (AARGLIST(alist)[i].ae_fnum == buf->b_fnum
|
||||||
|| path_full_compare(alist_name(&AARGLIST(alist)[i]),
|
|| path_full_compare(alist_name(&AARGLIST(alist)[i]),
|
||||||
buf->b_ffname, TRUE) & kEqualFiles)) {
|
buf->b_ffname, true) & kEqualFiles)) {
|
||||||
int weight = 1;
|
int weight = 1;
|
||||||
|
|
||||||
if (old_curtab == curtab) {
|
if (old_curtab == curtab) {
|
||||||
|
@@ -4977,7 +4977,8 @@ void fix_help_buffer(void)
|
|||||||
while (*p != NUL) {
|
while (*p != NUL) {
|
||||||
copy_option_part(&p, NameBuff, MAXPATHL, ",");
|
copy_option_part(&p, NameBuff, MAXPATHL, ",");
|
||||||
rt = (char_u *)vim_getenv("VIMRUNTIME");
|
rt = (char_u *)vim_getenv("VIMRUNTIME");
|
||||||
if (path_full_compare(rt, NameBuff, FALSE) != kEqualFiles) {
|
if (rt != NULL
|
||||||
|
&& path_full_compare(rt, NameBuff, false) != kEqualFiles) {
|
||||||
int fcount;
|
int fcount;
|
||||||
char_u **fnames;
|
char_u **fnames;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
@@ -5197,8 +5198,9 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
|
|||||||
* add the "help-tags" tag.
|
* add the "help-tags" tag.
|
||||||
*/
|
*/
|
||||||
ga_init(&ga, (int)sizeof(char_u *), 100);
|
ga_init(&ga, (int)sizeof(char_u *), 100);
|
||||||
if (add_help_tags || path_full_compare((char_u *)"$VIMRUNTIME/doc",
|
if (add_help_tags
|
||||||
dir, FALSE) == kEqualFiles) {
|
|| path_full_compare((char_u *)"$VIMRUNTIME/doc",
|
||||||
|
dir, false) == kEqualFiles) {
|
||||||
s = xmalloc(18 + STRLEN(tagfname));
|
s = xmalloc(18 + STRLEN(tagfname));
|
||||||
sprintf((char *)s, "help-tags\t%s\t1\n", tagfname);
|
sprintf((char *)s, "help-tags\t%s\t1\n", tagfname);
|
||||||
GA_APPEND(char_u *, &ga, s);
|
GA_APPEND(char_u *, &ga, s);
|
||||||
|
@@ -5062,38 +5062,33 @@ static void * call_user_expand_func(user_expand_func_T user_expand_func,
|
|||||||
*/
|
*/
|
||||||
static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)
|
static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)
|
||||||
{
|
{
|
||||||
char_u *retstr;
|
|
||||||
char_u *s;
|
|
||||||
char_u *e;
|
char_u *e;
|
||||||
char_u keep;
|
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
|
|
||||||
retstr = call_user_expand_func((user_expand_func_T)call_func_retstr, xp,
|
char_u *const retstr = call_user_expand_func(
|
||||||
num_file, file);
|
(user_expand_func_T)call_func_retstr, xp, num_file, file);
|
||||||
if (retstr == NULL) {
|
if (retstr == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ga_init(&ga, (int)sizeof(char *), 3);
|
ga_init(&ga, (int)sizeof(char *), 3);
|
||||||
for (s = retstr; *s != NUL; s = e) {
|
for (char_u *s = retstr; *s != NUL; s = e) {
|
||||||
e = vim_strchr(s, '\n');
|
e = vim_strchr(s, '\n');
|
||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
e = s + STRLEN(s);
|
e = s + STRLEN(s);
|
||||||
keep = *e;
|
const int keep = *e;
|
||||||
*e = 0;
|
*e = NUL;
|
||||||
|
|
||||||
if (xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0) {
|
const bool skip = xp->xp_pattern[0]
|
||||||
*e = keep;
|
&& vim_regexec(regmatch, s, (colnr_T)0) == 0;
|
||||||
if (*e != NUL)
|
*e = keep;
|
||||||
++e;
|
if (!skip) {
|
||||||
continue;
|
GA_APPEND(char_u *, &ga, vim_strnsave(s, (int)(e - s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
GA_APPEND(char_u *, &ga, vim_strnsave(s, (int)(e - s)));
|
if (*e != NUL) {
|
||||||
|
e++;
|
||||||
*e = keep;
|
}
|
||||||
if (*e != NUL)
|
|
||||||
++e;
|
|
||||||
}
|
}
|
||||||
xfree(retstr);
|
xfree(retstr);
|
||||||
*file = ga.ga_data;
|
*file = ga.ga_data;
|
||||||
|
@@ -1365,11 +1365,11 @@ recover_names (
|
|||||||
*/
|
*/
|
||||||
if (curbuf->b_ml.ml_mfp != NULL
|
if (curbuf->b_ml.ml_mfp != NULL
|
||||||
&& (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) {
|
&& (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) {
|
||||||
for (int i = 0; i < num_files; ++i)
|
for (int i = 0; i < num_files; i++) {
|
||||||
if (path_full_compare(p, files[i], TRUE) & kEqualFiles) {
|
if (path_full_compare(p, files[i], true) & kEqualFiles) {
|
||||||
/* Remove the name from files[i]. Move further entries
|
// Remove the name from files[i]. Move further entries
|
||||||
* down. When the array becomes empty free it here, since
|
// down. When the array becomes empty free it here, since
|
||||||
* FreeWild() won't be called below. */
|
// FreeWild() won't be called below.
|
||||||
xfree(files[i]);
|
xfree(files[i]);
|
||||||
if (--num_files == 0)
|
if (--num_files == 0)
|
||||||
xfree(files);
|
xfree(files);
|
||||||
@@ -1377,6 +1377,7 @@ recover_names (
|
|||||||
for (; i < num_files; ++i)
|
for (; i < num_files; ++i)
|
||||||
files[i] = files[i + 1];
|
files[i] = files[i + 1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (nr > 0) {
|
if (nr > 0) {
|
||||||
file_count += num_files;
|
file_count += num_files;
|
||||||
|
@@ -52,7 +52,8 @@
|
|||||||
/// @param s2 Second file name.
|
/// @param s2 Second file name.
|
||||||
/// @param checkname When both files don't exist, only compare their names.
|
/// @param checkname When both files don't exist, only compare their names.
|
||||||
/// @return Enum of type FileComparison. @see FileComparison.
|
/// @return Enum of type FileComparison. @see FileComparison.
|
||||||
FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname)
|
FileComparison path_full_compare(char_u *const s1, char_u *const s2,
|
||||||
|
const bool checkname)
|
||||||
{
|
{
|
||||||
assert(s1 && s2);
|
assert(s1 && s2);
|
||||||
char_u exp1[MAXPATHL];
|
char_u exp1[MAXPATHL];
|
||||||
|
@@ -3603,15 +3603,16 @@ void ex_vimgrep(exarg_T *eap)
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s != NULL && *s == NUL) {
|
if (s == NULL || *s == NUL) {
|
||||||
/* Pattern is empty, use last search pattern. */
|
// Pattern is empty, use last search pattern.
|
||||||
if (last_search_pat() == NULL) {
|
if (last_search_pat() == NULL) {
|
||||||
EMSG(_(e_noprevre));
|
EMSG(_(e_noprevre));
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
|
regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
|
||||||
} else
|
} else {
|
||||||
regmatch.regprog = vim_regcomp(s, RE_MAGIC);
|
regmatch.regprog = vim_regcomp(s, RE_MAGIC);
|
||||||
|
}
|
||||||
|
|
||||||
if (regmatch.regprog == NULL)
|
if (regmatch.regprog == NULL)
|
||||||
goto theend;
|
goto theend;
|
||||||
|
@@ -2043,9 +2043,11 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
dont_use_region = true;
|
dont_use_region = true;
|
||||||
|
|
||||||
// Check if we loaded this language before.
|
// Check if we loaded this language before.
|
||||||
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
|
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
|
||||||
if (path_full_compare(lang, slang->sl_fname, FALSE) == kEqualFiles)
|
if (path_full_compare(lang, slang->sl_fname, false) == kEqualFiles) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
filename = false;
|
filename = false;
|
||||||
if (len > 3 && lang[len - 3] == '_') {
|
if (len > 3 && lang[len - 3] == '_') {
|
||||||
@@ -2085,8 +2087,9 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop over the languages, there can be several files for "lang".
|
// Loop over the languages, there can be several files for "lang".
|
||||||
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
|
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
|
||||||
if (filename ? path_full_compare(lang, slang->sl_fname, FALSE) == kEqualFiles
|
if (filename
|
||||||
|
? path_full_compare(lang, slang->sl_fname, false) == kEqualFiles
|
||||||
: STRICMP(lang, slang->sl_name) == 0) {
|
: STRICMP(lang, slang->sl_name) == 0) {
|
||||||
region_mask = REGION_ALL;
|
region_mask = REGION_ALL;
|
||||||
if (!filename && region != NULL) {
|
if (!filename && region != NULL) {
|
||||||
@@ -2116,6 +2119,7 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
nobreak = true;
|
nobreak = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// round 0: load int_wordlist, if possible.
|
// round 0: load int_wordlist, if possible.
|
||||||
@@ -2137,17 +2141,21 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
// If it was already found above then skip it.
|
// If it was already found above then skip it.
|
||||||
for (c = 0; c < ga.ga_len; ++c) {
|
for (c = 0; c < ga.ga_len; ++c) {
|
||||||
p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname;
|
p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname;
|
||||||
if (p != NULL && path_full_compare(spf_name, p, FALSE) == kEqualFiles)
|
if (p != NULL
|
||||||
|
&& path_full_compare(spf_name, p, false) == kEqualFiles) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (c < ga.ga_len)
|
if (c < ga.ga_len)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it was loaded already.
|
// Check if it was loaded already.
|
||||||
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
|
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
|
||||||
if (path_full_compare(spf_name, slang->sl_fname, FALSE) == kEqualFiles)
|
if (path_full_compare(spf_name, slang->sl_fname, false) == kEqualFiles) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (slang == NULL) {
|
if (slang == NULL) {
|
||||||
// Not loaded, try loading it now. The language name includes the
|
// Not loaded, try loading it now. The language name includes the
|
||||||
// region name, the region is ignored otherwise. for int_wordlist
|
// region name, the region is ignored otherwise. for int_wordlist
|
||||||
|
@@ -1786,7 +1786,7 @@ spell_reload_one (
|
|||||||
bool didit = false;
|
bool didit = false;
|
||||||
|
|
||||||
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
|
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
|
||||||
if (path_full_compare(fname, slang->sl_fname, FALSE) == kEqualFiles) {
|
if (path_full_compare(fname, slang->sl_fname, false) == kEqualFiles) {
|
||||||
slang_clear(slang);
|
slang_clear(slang);
|
||||||
if (spell_load_file(fname, NULL, slang, false) == NULL)
|
if (spell_load_file(fname, NULL, slang, false) == NULL)
|
||||||
// reloading failed, clear the language
|
// reloading failed, clear the language
|
||||||
@@ -4714,9 +4714,11 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
|
|||||||
// pointer-linked version of the trie. And it avoids having two versions
|
// pointer-linked version of the trie. And it avoids having two versions
|
||||||
// of the code for the soundfolding stuff.
|
// of the code for the soundfolding stuff.
|
||||||
// It might have been done already by spell_reload_one().
|
// It might have been done already by spell_reload_one().
|
||||||
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
|
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
|
||||||
if (path_full_compare(wfname, slang->sl_fname, FALSE) == kEqualFiles)
|
if (path_full_compare(wfname, slang->sl_fname, false) == kEqualFiles) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (slang == NULL) {
|
if (slang == NULL) {
|
||||||
spell_message(spin, (char_u *)_("Reading back spell file..."));
|
spell_message(spin, (char_u *)_("Reading back spell file..."));
|
||||||
slang = spell_load_file(wfname, NULL, NULL, false);
|
slang = spell_load_file(wfname, NULL, NULL, false);
|
||||||
|
@@ -2289,7 +2289,7 @@ static char_u *tag_full_fname(tagptrs_T *tagp)
|
|||||||
{
|
{
|
||||||
int c = *tagp->fname_end;
|
int c = *tagp->fname_end;
|
||||||
*tagp->fname_end = NUL;
|
*tagp->fname_end = NUL;
|
||||||
char_u *fullname = expand_tag_fname(tagp->fname, tagp->tag_fname, FALSE);
|
char_u *fullname = expand_tag_fname(tagp->fname, tagp->tag_fname, false);
|
||||||
*tagp->fname_end = c;
|
*tagp->fname_end = c;
|
||||||
|
|
||||||
return fullname;
|
return fullname;
|
||||||
@@ -2363,8 +2363,8 @@ jumpto_tag (
|
|||||||
* Expand file name, when needed (for environment variables).
|
* Expand file name, when needed (for environment variables).
|
||||||
* If 'tagrelative' option set, may change file name.
|
* If 'tagrelative' option set, may change file name.
|
||||||
*/
|
*/
|
||||||
fname = expand_tag_fname(fname, tagp.tag_fname, TRUE);
|
fname = expand_tag_fname(fname, tagp.tag_fname, true);
|
||||||
tofree_fname = fname; /* free() it later */
|
tofree_fname = fname; // free() it later
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the file with the tag exists before abandoning the current
|
* Check if the file with the tag exists before abandoning the current
|
||||||
@@ -2615,13 +2615,12 @@ erret:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// If "expand" is true, expand wildcards in fname.
|
||||||
* If "expand" is TRUE, expand wildcards in fname.
|
// If 'tagrelative' option set, change fname (name of file containing tag)
|
||||||
* If 'tagrelative' option set, change fname (name of file containing tag)
|
// according to tag_fname (name of tag file containing fname).
|
||||||
* according to tag_fname (name of tag file containing fname).
|
// Returns a pointer to allocated memory.
|
||||||
* Returns a pointer to allocated memory.
|
static char_u *expand_tag_fname(char_u *fname, char_u *const tag_fname,
|
||||||
*/
|
const bool expand)
|
||||||
static char_u *expand_tag_fname(char_u *fname, char_u *tag_fname, int expand)
|
|
||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
char_u *expanded_fname = NULL;
|
char_u *expanded_fname = NULL;
|
||||||
@@ -2676,8 +2675,8 @@ static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname,
|
|||||||
c = *fname_end;
|
c = *fname_end;
|
||||||
*fname_end = NUL;
|
*fname_end = NUL;
|
||||||
}
|
}
|
||||||
fullname = expand_tag_fname(fname, tag_fname, TRUE);
|
fullname = expand_tag_fname(fname, tag_fname, true);
|
||||||
retval = (path_full_compare(fullname, buf_ffname, TRUE) & kEqualFiles);
|
retval = (path_full_compare(fullname, buf_ffname, true) & kEqualFiles);
|
||||||
xfree(fullname);
|
xfree(fullname);
|
||||||
*fname_end = c;
|
*fname_end = c;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user