1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 16:17:59 +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
{
completeFunc = function () completion[completeOptionMap[completeOpt]].apply(this, Array.slice(arguments));
completeFunc = completion[completeOptionMap[completeOpt]];
}
}
@@ -854,11 +854,7 @@ function Commands() //{{{
argCount: nargsOpt,
bang: bangOpt,
count: countOpt,
completer: function (context, args)
{
if (completeFunc)
return completeFunc(context, args)
},
completer: completeFunc,
replacementText: args.literalArg
}, args.bang);
@@ -870,8 +866,7 @@ function Commands() //{{{
function completerToString(completer)
{
if (completer)
return [k for ([k, v] in Iterator(completeOptionMap))
if (v == completer.name)][0] || "custom";
return [k for ([k, v] in Iterator(completeOptionMap)) if (completer == completion[v])][0] || "custom";
else
return "";
}
@@ -907,6 +902,7 @@ function Commands() //{{{
function (arg) /^[01*?+]$/.test(arg), ["0", "1", "*", "?", "+"]],
[["-bang"], self.OPTION_NOARG],
[["-count"], self.OPTION_NOARG],
// TODO: "E180: invalid complete value: " + arg
[["-complete"], self.OPTION_STRING,
function (arg) arg in completeOptionMap || /custom,\w+/.test(arg),
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
should be applied and *completions* is a two dimensional array of the form:
\[[arg1, description1], [arg2, description2], ...]
[[arg1, description1], [arg2, description2], ...]
// TODO: add examples