mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 02:34:11 +01:00
Fix help tag indexing for automagically generated index tags.
This commit is contained in:
@@ -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',
|
||||
'<?xml version="1.0"?>\n' +
|
||||
'<overlay xmlns="' + NS + '">\n' +
|
||||
unescape(encodeURI( // UTF-8 handling hack.
|
||||
@@ -804,6 +806,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}</dl>, <>{"\n\n"}</>))) +
|
||||
'\n</overlay>'];
|
||||
|
||||
addTags("index", util.httpGet("dactyl://help-overlay/index").responseXML);
|
||||
addTags("index", util.httpGet("dactyl://help/index").responseXML);
|
||||
|
||||
this.helpInitialized = true;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user