0
0
mirror of https://github.com/vim/vim.git synced 2025-07-25 10:54:51 -04:00

updated for version 7.3.341

Problem:    Local help files are only listed in help.txt, not in translated
            help files.
Solution:   Also find translated help files. (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar 2011-10-20 18:17:42 +02:00
parent f34dc6537d
commit 667b4d2db9
2 changed files with 166 additions and 100 deletions

View File

@ -5982,6 +5982,7 @@ fix_help_buffer()
char_u *line; char_u *line;
int in_example = FALSE; int in_example = FALSE;
int len; int len;
char_u *fname;
char_u *p; char_u *p;
char_u *rt; char_u *rt;
int mustfree; int mustfree;
@ -6028,16 +6029,26 @@ fix_help_buffer()
} }
/* /*
* In the "help.txt" file, add the locally added help files. * In the "help.txt" and "help.abx" file, add the locally added help
* This uses the very first line in the help file. * files. This uses the very first line in the help file.
*/ */
if (fnamecmp(gettail(curbuf->b_fname), "help.txt") == 0) fname = gettail(curbuf->b_fname);
if (fnamecmp(fname, "help.txt") == 0
#ifdef FEAT_MULTI_LANG
|| (fnamencmp(fname, "help.", 5) == 0
&& ASCII_ISALPHA(fname[5])
&& ASCII_ISALPHA(fname[6])
&& TOLOWER_ASC(fname[7]) == 'x'
&& fname[8] == NUL)
#endif
)
{ {
for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum) for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
{ {
line = ml_get_buf(curbuf, lnum, FALSE); line = ml_get_buf(curbuf, lnum, FALSE);
if (strstr((char *)line, "*local-additions*") != NULL) if (strstr((char *)line, "*local-additions*") == NULL)
{ continue;
/* Go through all directories in 'runtimepath', skipping /* Go through all directories in 'runtimepath', skipping
* $VIMRUNTIME. */ * $VIMRUNTIME. */
p = p_rtp; p = p_rtp;
@ -6060,13 +6071,67 @@ fix_help_buffer()
/* Find all "doc/ *.txt" files in this directory. */ /* Find all "doc/ *.txt" files in this directory. */
add_pathsep(NameBuff); add_pathsep(NameBuff);
#ifdef FEAT_MULTI_LANG
STRCAT(NameBuff, "doc/*.??[tx]");
#else
STRCAT(NameBuff, "doc/*.txt"); STRCAT(NameBuff, "doc/*.txt");
#endif
if (gen_expand_wildcards(1, &NameBuff, &fcount, if (gen_expand_wildcards(1, &NameBuff, &fcount,
&fnames, EW_FILE|EW_SILENT) == OK &fnames, EW_FILE|EW_SILENT) == OK
&& fcount > 0) && fcount > 0)
{ {
#ifdef FEAT_MULTI_LANG
int i1;
int i2;
char_u *f1;
char_u *f2;
char_u *t1;
char_u *e1;
char_u *e2;
/* If foo.abx is found use it instead of foo.txt in
* the same directory. */
for (i1 = 0; i1 < fcount; ++i1)
{
for (i2 = 0; i2 < fcount; ++i2)
{
if (i1 == i2)
continue;
if (fnames[i1] == NULL || fnames[i2] == NULL)
continue;
f1 = fnames[i1];
f2 = fnames[i2];
t1 = gettail(f1);
if (fnamencmp(f1, f2, t1 - f1) != 0)
continue;
e1 = vim_strrchr(t1, '.');
e2 = vim_strrchr(gettail(f2), '.');
if (e1 == NUL || e2 == NUL)
continue;
if (fnamecmp(e1, ".txt") != 0
&& fnamecmp(e1, fname + 4) != 0)
{
/* Not .txt and not .abx, remove it. */
vim_free(fnames[i1]);
fnames[i1] = NULL;
continue;
}
if (fnamencmp(f1, f2, e1 - f1) != 0)
continue;
if (fnamecmp(e1, ".txt") == 0
&& fnamecmp(e2, fname + 4) == 0)
{
/* use .abx instead of .txt */
vim_free(fnames[i1]);
fnames[i1] = NULL;
}
}
}
#endif
for (fi = 0; fi < fcount; ++fi) for (fi = 0; fi < fcount; ++fi)
{ {
if (fnames[fi] == NULL)
continue;
fd = mch_fopen((char *)fnames[fi], "r"); fd = mch_fopen((char *)fnames[fi], "r");
if (fd != NULL) if (fd != NULL)
{ {
@ -6147,7 +6212,6 @@ fix_help_buffer()
break; break;
} }
} }
}
} }
/* /*

View File

@ -709,6 +709,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
341,
/**/ /**/
340, 340,
/**/ /**/