mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-12 10:05:45 +01:00
Accept more plausible URLs rather than falling back to horrid defsearch. Closes issue #338.
This commit is contained in:
@@ -384,7 +384,7 @@ var Addons = Module("addons", {
|
||||
}, {
|
||||
argCount: "1",
|
||||
completer: function (context) {
|
||||
context.filters.push(function ({ item }) item.isDirectory() || /\.xpi$/.test(item.leafName));
|
||||
context.filters.push(function ({ isdir, text }) isdir || /\.xpi$/.test(text));
|
||||
completion.file(context);
|
||||
},
|
||||
literal: 0
|
||||
|
||||
@@ -899,32 +899,27 @@ var Completion = Module("completion", {
|
||||
// depending on the 'complete' option
|
||||
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option
|
||||
url: function url(context, complete) {
|
||||
let numLocationCompletions = 0; // how many async completions did we already return to the caller?
|
||||
let start = 0;
|
||||
let skip = 0;
|
||||
|
||||
if (this.options["urlseparator"])
|
||||
skip = context.filter.match("^.*" + this.options["urlseparator"]); // start after the last 'urlseparator'
|
||||
|
||||
var skip = RegExp("^.*" + this.options["urlseparator"] + "\\s*").exec(context.filter);
|
||||
if (skip)
|
||||
context.advance(skip[0].length);
|
||||
|
||||
if (complete == null)
|
||||
complete = this.options["complete"];
|
||||
|
||||
if (/^about:/.test(context.filter)) {
|
||||
if (/^about:/.test(context.filter))
|
||||
context.fork("about", 6, this, function (context) {
|
||||
context.generate = function () {
|
||||
const PREFIX = "@mozilla.org/network/protocol/about;1?what=";
|
||||
return [[k.substr(PREFIX.length), ""] for (k in Cc) if (k.indexOf(PREFIX) == 0)];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (complete == null)
|
||||
complete = this.options["complete"];
|
||||
|
||||
// Will, and should, throw an error if !(c in opts)
|
||||
Array.forEach(complete, function (c) {
|
||||
let completer = this.urlCompleters[c];
|
||||
context.fork.apply(context, [c, 0, this, completer.completer].concat(completer.args));
|
||||
context.forkapply(c, 0, this, completer.completer, completer.args);
|
||||
}, this);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user