diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 1d27671f..986d93e7 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -208,14 +208,16 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }, options: params.options || [] }); + if (params.index) this.indices[params.index] = function () { let results = array((params.iterateIndex || params.iterate).call(params, commands.get(name).newArgs())) .array.sort(function (a, b) String.localeCompare(a.name, b.name)); + let tags = services["dactyl:"].HELP_TAGS; for (let obj in values(results)) { let res = dactyl.generateHelp(obj, null, null, true); - if (!set.has(services["dactyl:"].HELP_TAGS, obj.helpTag)) + if (!set.has(tags, obj.helpTag)) res[1].@tag = obj.helpTag; yield res; @@ -794,7 +796,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { default xml namespace = NS; - overlayMap["index"] = function () ['text/xml;charset=UTF-8', + overlayMap["index"] = ['text/xml;charset=UTF-8', '\n' + '\n' + unescape(encodeURI( // UTF-8 handling hack. @@ -804,6 +806,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }, <>{"\n\n"}))) + '\n']; + addTags("index", util.httpGet("dactyl://help-overlay/index").responseXML); addTags("index", util.httpGet("dactyl://help/index").responseXML); this.helpInitialized = true; diff --git a/common/modules/options.jsm b/common/modules/options.jsm index 7c3403a5..6beff5e6 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -895,7 +895,12 @@ var Options = Module("options", { ret.optionValue = ret.option.get(ret.scope); - ret.values = ret.option.parse(ret.value); + try { + ret.values = ret.option.parse(ret.value); + } + catch (e) { + ret.error = e; + } return ret; }, @@ -1095,21 +1100,23 @@ var Options = Module("options", { return completion.option(context, opt.scope, prefix); } - let option = opt.option; - if (!option) { - context.message = "No such option: " + opt.name; - context.highlight(0, opt.name.length, "SPELLCHECK"); - return; + function error(length, message) { + context.message = message; + context.highlight(0, length, "SPELLCHECK"); } + let option = opt.option; + if (!option) + return error(opt.name.length, "No such option: " + opt.name); + context.advance(context.filter.indexOf("=")); - if (option.type == "boolean") { - context.message = "Trailing characters"; - context.highlight(0, context.filter.length, "SPELLCHECK"); - return; - } + if (option.type == "boolean") + return error(context.filter.length, "Trailing characters"); context.advance(1); + if (opt.error) + return error(context.filter.length, opt.error); + if (opt.get || opt.reset || !option || prefix) return null;