summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-28 19:59:02 +0200
committerBram Moolenaar <Bram@vim.org>2016-03-28 19:59:02 +0200
commit61264d99692803eec76a171916ab9720c75536b0 (patch)
treecb4071b5069ec65cbb49d4e4ce1f99b1893ed338
parenta32095fc8fdf5fe3d487c86d9cc54adb1236731e (diff)
downloadvim-git-61264d99692803eec76a171916ab9720c75536b0.tar.gz
patch 7.4.1671v7.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)
-rw-r--r--src/ex_getln.c26
-rw-r--r--src/version.c2
2 files changed, 26 insertions, 2 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 740c4b6cf..11824907e 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4491,7 +4491,9 @@ expand_cmdline(
#ifdef FEAT_MULTI_LANG
/*
- * Cleanup matches for help tags: remove "@en" if "en" is the only language.
+ * Cleanup matches for help tags:
+ * 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);
@@ -4500,11 +4502,28 @@ cleanup_help_tags(int num_file, char_u **file)
{
int i, j;
int len;
+ char_u buf[4];
+ char_u *p = buf;
+
+ if (p_hlg[0] != NUL)
+ {
+ *p++ = '@';
+ *p++ = p_hlg[0];
+ *p++ = p_hlg[1];
+ }
+ *p = NUL;
for (i = 0; i < num_file; ++i)
{
len = (int)STRLEN(file[i]) - 3;
- if (len > 0 && STRCMP(file[i] + len, "@en") == 0)
+ 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". */
@@ -4514,7 +4533,10 @@ cleanup_help_tags(int num_file, char_u **file)
&& STRNCMP(file[i], file[j], len + 1) == 0)
break;
if (j == num_file)
+ {
file[i][len] = NUL;
+ break;
+ }
}
}
}
diff --git a/src/version.c b/src/version.c
index 7039002fc..a26efec39 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1671,
+/**/
1670,
/**/
1669,