1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 16:07:59 +01:00

Update (sort-of) the :com -complete docs.

This commit is contained in:
Kris Maglione
2008-12-16 22:19:46 -05:00
parent 2a4352b868
commit df33e3e7c7
2 changed files with 11 additions and 11 deletions

View File

@@ -757,16 +757,14 @@ function Commands() //{{{
if (completeOpt)
{
let func;
// TODO: Should we catch any eval error? It'll be reported anyway.
if (/^custom,/.test(completeOpt))
func = completeOpt.replace("custom,", "");
completeFunc = liberator.eval(completeOpt.substr(7));
else
func = "completion." + completeOptionMap[completeOpt];
completeFunc = completion[completeOptionMap[completeOpt]];
//completeFunc = eval(func);
completeFunc = func;
liberator.log(func)
if (completeFunc == null)
return liberator.echoerr("No such completion function");
}
if (!commands.addUserCommand(
@@ -779,7 +777,7 @@ function Commands() //{{{
count: countOpt,
// TODO: handle missing function
//completer: completeFunc,
completer: function (context, args) eval(completeFunc + "(context, args)"),
completer: function (context, args) eval(completeFunc(context, args)),
replacementText: args.literalArg
},
args.bang)

View File

@@ -323,8 +323,10 @@ Completion can be enabled by specifying one of the following arguments to the
Custom completion
Custom completion can be provided by specifying the "custom,{func}" argument to
-complete. The {func} is called with one argument, the word being completed,
and should return an array [start, completions].
-complete. The {func} is called with to arguments, a completion context, and
an an object describing the command's arguments. It should set the context's
'completions' property, or return an object, with 'start' and 'items'
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: