Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("completion", {
exports: ["CompletionContext", "Completion", "completion"],
- use: ["config", "template", "util"]
+ use: ["config", "messages", "template", "util"]
}, this);
/**
* The message displayed at the head of the completions for the
* current context.
*/
- get message() this._message || (this.waitingForTab && this.hasItems !== false ? "Waiting for <Tab>" : null),
+ get message() this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "<Tab>") : null),
set message(val) this._message = val,
/**
* The prototype object for items returned by {@link items}.
*/
get itemPrototype() {
- let res = {};
+ let res = { highlight: "" };
function result(quote) {
- yield ["result", quote ? function () quote[0] + quote[1](this.text) + quote[2]
+ yield ["result", quote ? function () quote[0] + util.trapErrors(1, quote, this.text) + quote[2]
: function () this.text];
};
for (let i in iter(this.keys, result(this.quote))) {
}
catch (e) {
util.reportError(e);
- this.message = "Error: " + e;
+ this.message = _("error.error", e);
}
}
// XXX
return this.cache.filtered = filtered;
}
catch (e) {
- this.message = "Error: " + e;
+ this.message = _("error.error", e);
util.reportError(e);
return [];
}
// depending on the 'complete' option
// if the 'complete' argument is passed like "h", it temporarily overrides the complete option
url: function url(context, complete) {
+ if (/^jar:[^!]*$/.test(context.filter)) {
+ context.advance(4);
+
+ context.quote = context.quote || ["", util.identity, ""];
+ let quote = context.quote[1];
+ context.quote[1] = function (str) quote(str.replace(/!/g, escape));
+ }
if (this.options["urlseparator"])
var skip = util.regexp("^.*" + this.options["urlseparator"] + "\\s*")
context.title = ["URL", "Title"];
context.fork("additional", 0, this, function (context) {
- context.title[0] += " (additional)";
+ context.title[0] += " " + _("completion.additional");
context.filter = context.parent.filter; // FIXME
context.completions = context.parent.completions;
// For items whose URL doesn't exactly match the filter,
};
options.add(["altwildmode", "awim"],
- "Define the behavior of the <A-Tab> key in command-line completion",
+ "Define the behavior of the c_<A-Tab> key in command-line completion",
"stringlist", "list:full",
wildmode);
});
options.add(["wildmode", "wim"],
- "Define the behavior of the <Tab> key in command-line completion",
+ "Define the behavior of the c_<Tab> key in command-line completion",
"stringlist", "list:full",
wildmode);