Hi,
2016/2/18 Thu 18:47:08 UTC+9 mattn wrote:
> Hi.
>
> try typing in command line. when having two or more help file languages,
> completion behave strange.
>
> (1) complete with all languages
>
> :help expr-stri<TAB>
>
> candidates
> * expr-string@en
> * expr-string@ja
>
> (2) complete with all languages
>
> :help expr-string@<TAB>
>
> No candidates
>
> Is this right?
I have a related issue with this for a long time.
Assume Japanese help (@ja) and English help (@en) are installed.
When `:set wildmode=longest` is set, and type the following:
:help expr-stri<TAB>
The completion result is:
:help expr-string@
Then enter <CR>, I get "E149: Sorry, no help for expr-string@".
I have to remove the last "@" or append "ja" to get the help for this item.
This is very annoying.
I wrote a patch for this. With this patch, when the first candidate has an
"@ab" extension and it matches the first language in 'helplang', "@ab" is
omitted. In this case, candidates become:
* expr-string (@ja is omitted.)
* expr-string@en
So the completion result is:
:help expr-string
Now I can get the help for this item just entering <CR>.
Please check the attached patch.
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent 13ed959dbc0001299b147f74bc21530391e88104
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -258,7 +258,9 @@ The second one finds the English user ma
When using command-line completion for the ":help" command, the "@en"
extension is only shown when a tag exists for multiple languages. When the
-tag only exists for English "@en" is omitted.
+tag only exists for English "@en" is omitted. When the first candidate has an
+"@ab" extension and it matches the first language in 'helplang' "@ab" is also
+omitted.
When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
find the tag in the same language. If not found then 'helplang' will be used
diff --git a/src/ex_getln.c b/src/ex_getln.c
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4492,7 +4492,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);
@@ -4501,11 +4503,28 @@ cleanup_help_tags(int num_file, char_u *
{
int i, j;
int len;
+ char_u buf[4];
+ char_u *p = buf;
+
+ if (p_hlg && 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". */