mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 16:47:59 +01:00
Allow extra args to be bassed to completion.addUrlCompleter
This commit is contained in:
@@ -579,7 +579,7 @@ CompletionContext.prototype = {
|
|||||||
let context = new CompletionContext(this, name, offset);
|
let context = new CompletionContext(this, name, offset);
|
||||||
this.contextList.push(context);
|
this.contextList.push(context);
|
||||||
if (completer)
|
if (completer)
|
||||||
return completer.apply(self || this, [context].concat(Array.slice(arguments, 4)));
|
return completer.apply(self || this, [context].concat(Array.slice(arguments, arguments.callee.length)));
|
||||||
return context;
|
return context;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1803,15 +1803,19 @@ function Completion() //{{{
|
|||||||
context.advance(skip[0].length);
|
context.advance(skip[0].length);
|
||||||
|
|
||||||
// Will, and should, throw an error if !(c in opts)
|
// Will, and should, throw an error if !(c in opts)
|
||||||
Array.forEach(complete || options["complete"],
|
Array.forEach(complete || options["complete"], function (c) {
|
||||||
function (c) context.fork(c, 0, completion, completion.urlCompleters[c].completer));
|
let completer = completion.urlCompleters[c];
|
||||||
|
context.fork.apply(context, [c, 0, completion, completer.completer].concat(completer.args));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
urlCompleters: {},
|
urlCompleters: {},
|
||||||
|
|
||||||
addUrlCompleter: function addUrlCompleter(opt)
|
addUrlCompleter: function addUrlCompleter(opt)
|
||||||
{
|
{
|
||||||
this.urlCompleters[opt] = UrlCompleter.apply(null, Array.slice(arguments));
|
let completer = UrlCompleter.apply(null, Array.slice(arguments));
|
||||||
|
completer.args = Array.slice(arguments, completer.length);
|
||||||
|
this.urlCompleters[opt] = completer;
|
||||||
},
|
},
|
||||||
|
|
||||||
urls: function (context, tags)
|
urls: function (context, tags)
|
||||||
|
|||||||
Reference in New Issue
Block a user