vim-patch:7.4.1671

Problem:    When help exists in multiple languages, adding @ab while "ab" is
            the default help language is unnecessary.
Solution:   Leave out "@ab" when not needed. (Ken Takata)

61264d9969
This commit is contained in:
Jurica Bradaric 2016-09-18 17:29:42 +02:00
parent 68bcb32ec4
commit 6e55d99f43
2 changed files with 32 additions and 15 deletions

View File

@ -3669,27 +3669,44 @@ expand_cmdline (
return EXPAND_OK; return EXPAND_OK;
} }
/* // Cleanup matches for help tags:
* Cleanup matches for help tags: remove "@en" if "en" is the only language. // Remove "@ab" if the top of 'helplang' is "ab" and the language of the first
*/ // tag matches it. Otherwise remove "@en" if "en" is the only language.
static void cleanup_help_tags(int num_file, char_u **file) static void cleanup_help_tags(int num_file, char_u **file)
{ {
int i, j; char_u buf[4];
int len; char_u *p = buf;
for (i = 0; i < num_file; ++i) { if (p_hlg[0] != NUL) {
len = (int)STRLEN(file[i]) - 3; *p++ = '@';
if (len > 0 && STRCMP(file[i] + len, "@en") == 0) { *p++ = p_hlg[0];
/* Sorting on priority means the same item in another language may *p++ = p_hlg[1];
* be anywhere. Search all items for a match up to the "@en". */ }
for (j = 0; j < num_file; ++j) *p = NUL;
for (int i = 0; i < num_file; i++) {
int len = (int)STRLEN(file[i]) - 3;
if (len <= 0) {
continue;
}
if (i == 0 && STRCMP(file[i] + len, buf) == 0) {
file[i][len] = NUL;
break;
} else if (STRCMP(file[i] + len, "@en") == 0) {
// Sorting on priority means the same item in another language may
// be anywhere. Search all items for a match up to the "@en".
int j;
for (j = 0; j < num_file; j++) {
if (j != i if (j != i
&& (int)STRLEN(file[j]) == len + 3 && (int)STRLEN(file[j]) == len + 3
&& STRNCMP(file[i], file[j], len + 1) == 0) && STRNCMP(file[i], file[j], len + 1) == 0) {
break; break;
if (j == num_file) }
}
if (j == num_file) {
file[i][len] = NUL; file[i][len] = NUL;
break;
}
} }
} }
} }

View File

@ -772,7 +772,7 @@ static int included_patches[] = {
// 1674 NA // 1674 NA
1673, 1673,
// 1672 NA // 1672 NA
// 1671, 1671,
// 1670, // 1670,
// 1669 NA // 1669 NA
// 1668 NA // 1668 NA