Bram Moolenaar wrote:

> Patch 7.3.198
> Problem:    No completion for ":lang".
> Solution:   Get locales to complete from. (Dominique Pelle)
> Files:      src/eval.c, src/ex_cmds2.c, src/ex_getln.c,
>            src/proto/ex_cmds2.pro, src/proto/ex_getln.pro, src/vim.h


Hi Bram

Thanks for applying the patch.  I noticed that a piece is
missing though in src/ex_docmd.c, which was in my
original patch.

As result, the following command does not perform any
completion in Vim-7.3.198:

  :language messages <C-D>

I would expect it to complete with available locales.

Attached patch fixes it.  This is almost the same as what was
in my original patch, but I decided to change STRNICMP(...)
into STRNCMP(...) or else the following command gave spurious
locale completion:

  :language C <C-D>

"C" being a local name, it should not complete just because
"C" matches the beginning of ctype.

Thanks
-- Dominique

-- 
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
diff -r f0cc719cd129 src/ex_docmd.c
--- a/src/ex_docmd.c	Thu May 19 18:26:40 2011 +0200
+++ b/src/ex_docmd.c	Fri May 20 20:44:19 2011 +0200
@@ -3861,13 +3861,24 @@
 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
 	&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
 	case CMD_language:
-	    if (*skiptowhite(arg) == NUL)
+	    p = skiptowhite(arg);
+	    if (*p == NUL)
 	    {
 		xp->xp_context = EXPAND_LANGUAGE;
 		xp->xp_pattern = arg;
 	    }
 	    else
-		xp->xp_context = EXPAND_NOTHING;
+	    {
+		if ( STRNCMP(arg, "messages", p - arg) == 0
+		  || STRNCMP(arg, "ctype", p - arg) == 0
+		  || STRNCMP(arg, "time", p - arg) == 0)
+		{
+		    xp->xp_context = EXPAND_LOCALES;
+		    xp->xp_pattern = skipwhite(p);
+		}
+		else
+		    xp->xp_context = EXPAND_NOTHING;
+	    }
 	    break;
 #endif
 #if defined(FEAT_PROFILE)

Raspunde prin e-mail lui