1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 18:47:58 +01:00

Fix user command completer listing in :command output.

This commit is contained in:
Doug Kearns
2009-01-11 19:41:46 +11:00
parent 9729969d8b
commit 723dd9cbca
2 changed files with 5 additions and 9 deletions

View File

@@ -843,7 +843,7 @@ function Commands() //{{{
} }
else else
{ {
completeFunc = function () completion[completeOptionMap[completeOpt]].apply(this, Array.slice(arguments)); completeFunc = completion[completeOptionMap[completeOpt]];
} }
} }
@@ -854,11 +854,7 @@ function Commands() //{{{
argCount: nargsOpt, argCount: nargsOpt,
bang: bangOpt, bang: bangOpt,
count: countOpt, count: countOpt,
completer: function (context, args) completer: completeFunc,
{
if (completeFunc)
return completeFunc(context, args)
},
replacementText: args.literalArg replacementText: args.literalArg
}, args.bang); }, args.bang);
@@ -870,8 +866,7 @@ function Commands() //{{{
function completerToString(completer) function completerToString(completer)
{ {
if (completer) if (completer)
return [k for ([k, v] in Iterator(completeOptionMap)) return [k for ([k, v] in Iterator(completeOptionMap)) if (completer == completion[v])][0] || "custom";
if (v == completer.name)][0] || "custom";
else else
return ""; return "";
} }
@@ -907,6 +902,7 @@ function Commands() //{{{
function (arg) /^[01*?+]$/.test(arg), ["0", "1", "*", "?", "+"]], function (arg) /^[01*?+]$/.test(arg), ["0", "1", "*", "?", "+"]],
[["-bang"], self.OPTION_NOARG], [["-bang"], self.OPTION_NOARG],
[["-count"], self.OPTION_NOARG], [["-count"], self.OPTION_NOARG],
// TODO: "E180: invalid complete value: " + arg
[["-complete"], self.OPTION_STRING, [["-complete"], self.OPTION_STRING,
function (arg) arg in completeOptionMap || /custom,\w+/.test(arg), function (arg) arg in completeOptionMap || /custom,\w+/.test(arg),
function (context) [[k, ""] for ([k, v] in Iterator(completeOptionMap))]] function (context) [[k, ""] for ([k, v] in Iterator(completeOptionMap))]]

View File

@@ -330,7 +330,7 @@ properties, describing the completions and where the replacement is to start.
*start* is the index into the word being completed at which the returned values *start* is the index into the word being completed at which the returned values
should be applied and *completions* is a two dimensional array of the form: should be applied and *completions* is a two dimensional array of the form:
\[[arg1, description1], [arg2, description2], ...] [[arg1, description1], [arg2, description2], ...]
// TODO: add examples // TODO: add examples