X-Git-Url: https://git.donarmstrong.com/dactyl.git?a=blobdiff_plain;f=common%2Fmodules%2Fcompletion.jsm;h=9671e95aad543f8eadf3a5f6acaaf8498bef26c0;hb=70740024f9c028c1fd63e1a1850ab062ff956054;hp=b7a34e54938363c25e27ba0a03db622fe190736a;hpb=718c614c183350706466e22939d0101ca4c87efe;p=dactyl.git diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index b7a34e5..9671e95 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -11,7 +11,7 @@ try { Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("completion", { exports: ["CompletionContext", "Completion", "completion"], - use: ["config", "template", "util"] + use: ["config", "messages", "template", "util"] }, this); /** @@ -331,16 +331,16 @@ var CompletionContext = Class("CompletionContext", { * The message displayed at the head of the completions for the * current context. */ - get message() this._message || (this.waitingForTab && this.hasItems !== false ? "Waiting for " : null), + get message() this._message || (this.waitingForTab && this.hasItems !== false ? _("completion.waitingFor", "") : 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))) { @@ -396,7 +396,7 @@ var CompletionContext = Class("CompletionContext", { } catch (e) { util.reportError(e); - this.message = "Error: " + e; + this.message = _("error.error", e); } } // XXX @@ -495,7 +495,7 @@ var CompletionContext = Class("CompletionContext", { return this.cache.filtered = filtered; } catch (e) { - this.message = "Error: " + e; + this.message = _("error.error", e); util.reportError(e); return []; } @@ -903,6 +903,13 @@ 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) { + 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*") @@ -953,7 +960,7 @@ var Completion = Module("completion", { 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, @@ -1037,7 +1044,7 @@ var Completion = Module("completion", { }; options.add(["altwildmode", "awim"], - "Define the behavior of the key in command-line completion", + "Define the behavior of the c_ key in command-line completion", "stringlist", "list:full", wildmode); @@ -1066,7 +1073,7 @@ var Completion = Module("completion", { }); options.add(["wildmode", "wim"], - "Define the behavior of the key in command-line completion", + "Define the behavior of the c_ key in command-line completion", "stringlist", "list:full", wildmode);