diff --git a/common/content/mappings.js b/common/content/mappings.js index bc82ea02..fce82cf7 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -289,7 +289,7 @@ var Mappings = Module("mappings", { iterate: function (mode) { let seen = {}; for (let hive in this.hives.iterValues()) - for (let map in values(hive.getStack(mode))) + for (let map in hive.getStack(mode).iterValues()) if (!set.add(seen, map.name)) yield map; }, @@ -732,9 +732,22 @@ var Mappings = Module("mappings", { let args = { getMode: function (args) findMode(args["-mode"]), iterate: function (args) { - for (let map in mappings.iterate(this.getMode(args))) - for (let name in values(map.names)) - yield { name: name, __proto__: map }; + let mainMode = this.getMode(args); + let seen = {}; + for (let mode in values([mainMode].concat(mainMode.bases))) + for (let hive in mappings.hives.iterValues()) + for (let map in array.iterValues(hive.getStack(mode))) + for (let name in values(map.names)) + if (!set.add(seen, name)) { + yield { + name: name, + columns: [ + mode == mainMode ? "" : {mode.name}, + hive.name == "builtin" ? "" : {hive.name}, + ], + __proto__: map + }; + } }, format: { description: function (map) (XML.ignoreWhitespace = false, XML.prettyPrinting = false, <> @@ -744,7 +757,8 @@ var Mappings = Module("mappings", { {template.linkifyHelp(map.description + (map.rhs ? ": " + map.rhs : ""))} ), help: function (map) let (char = array.compact(map.modes.map(function (m) m.char))[0]) - char === "n" ? map.name : char ? char + "_" + map.name : "" + char === "n" ? map.name : char ? char + "_" + map.name : "", + headings: ["Command", "Mode", "Group", "Description"] } } diff --git a/common/content/statusline.js b/common/content/statusline.js index 262673b3..cec6fbcf 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -22,7 +22,7 @@ var StatusLine = Module("statusline", { #addon-bar > #addonbar-closebutton { visibility: collapse; } #addon-bar > xul|toolbarspring { visibility: collapse; } ]]>); - highlight.loadCSS(String.replace(, "", util.OS.isMacOSX ? "padding-right: 10px !important;" : "")); + ]]>)({ padding: util.OS.isMacOSX ? "padding-right: 10px !important;" : "" })); } let _commandline = "if (window.dactyl) return dactyl.modules.commandline"; diff --git a/common/modules/io.jsm b/common/modules/io.jsm index a83bde28..a89e1809 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -622,7 +622,7 @@ var IO = Module("io", { file.append(config.name + ".vim"); dactyl.assert(!file.exists() || args.bang, "File exists"); - let template = util.compileMacro(String( @@ -707,7 +707,7 @@ let &cpo = s:cpo_save unlet s:cpo_save " vim: tw=130 et ts=4 sw=4: -]]>), true); +]]>, true); const WIDTH = 80; function wrap(prefix, items, sep) { diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 4ce6a31f..2f50fc91 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -319,8 +319,9 @@ var Template = Module("Template", { usage: function usage(iter, format) { XML.ignoreWhitespace = false; XML.prettyPrinting = false; - let desc = format && format.description || function (item) template.linkifyHelp(item.description); - let help = format && format.help || function (item) item.name; + format = format || {}; + let desc = format.description || function (item) template.linkifyHelp(item.description); + let help = format.help || function (item) item.name; function sourceLink(frame) { let source = template.sourceLink(frame); source.@NS::hint = source.text(); @@ -328,6 +329,20 @@ var Template = Module("Template", { } // return + { format.headings ? + + { + this.map(format.headings, function (h) ) + } + : "" + } + { format.columns ? + + { + this.map(format.columns, function (c) ) + } + : "" + } { this.map(iter, function (item) @@ -339,7 +354,7 @@ var Template = Module("Template", { Defined at {sourceLink(frame)} } - { template.map(item.columns, function (c) ) } + { item.columns ? template.map(item.columns, function (c) ) : "" } ) } diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 477ee424..70ecdd53 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -336,6 +336,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), (\}>) // 5 ) ]]>, "giy"); + macro = String(macro); while (match = re.exec(macro)) { let [, prefix, open, full, macro, close] = match; end += match[0].length;
{h}
{c}{c}{desc(item)}