X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fcontent%2Fmappings.js;h=68bba94c6e9bed082211128e30069ddb5cf53b8e;hb=3d837eb266a3a01d424192aa4ec1a167366178c5;hp=f14b3d2f5fbbbf2a004b8396beaf926fc83824d6;hpb=5ebd29f56d17f62011cdd596b1d351947ee534ff;p=dactyl.git diff --git a/common/content/mappings.js b/common/content/mappings.js index f14b3d2..68bba94 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -1,10 +1,10 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2011 by Kris Maglione +// Copyright (c) 2008-2012 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. -/* use strict */ +"use strict"; /** @scope modules */ @@ -123,8 +123,7 @@ var Map = Class("Map", { contexts.context, args); - let self = this; - function repeat() self.action(args) + let repeat = () => this.action(args); if (this.names[0] != ".") // FIXME: Kludge. mappings.repeat = repeat; @@ -480,34 +479,30 @@ var Mappings = Module("mappings", { return maps; } - let list = - - - - - - - { - template.map(hives, function ([hive, maps]) let (i = 0) - + - template.map(maps, function (map) - template.map(map.names, function (name) - - - - - - )) + - ) - } -
- {_("title.Mode")}{_("title.Command")}{_("title.Action")}
{!i++ ? hive.name : ""}{modeSign}{name}{map.rhs || map.action.toSource()}
; - - // TODO: Move this to an ItemList to show this automatically - if (list.*.length() === list.text().length() + 2) - dactyl.echomsg(_("map.none")); - else - commandline.commandOutput(list); + let list = ["table", {}, + ["tr", { highlight: "Title" }, + ["td", {}], + ["td", { style: "padding-right: 1em;" }, _("title.Mode")], + ["td", { style: "padding-right: 1em;" }, _("title.Command")], + ["td", { style: "padding-right: 1em;" }, _("title.Action")]], + ["col", { style: "min-width: 6em; padding-right: 1em;" }], + hives.map(function ([hive, maps]) let (i = 0) [ + ["tr", { style: "height: .5ex;" }], + maps.map(function (map) + map.names.map(function (name) + ["tr", {}, + ["td", { highlight: "Title" }, !i++ ? hive.name : ""], + ["td", {}, modeSign], + ["td", {}, name], + ["td", {}, map.rhs || map.action.toSource()]])), + ["tr", { style: "height: .5ex;" }]])]; + + // E4X-FIXME + // // TODO: Move this to an ItemList to show this automatically + // if (list.*.length() === list.text().length() + 2) + // dactyl.echomsg(_("map.none")); + // else + commandline.commandOutput(list); } }, { }, { @@ -576,7 +571,7 @@ var Mappings = Module("mappings", { options: [ { names: ["-arg", "-a"], - description: "Accept an argument after the requisite key press", + description: "Accept an argument after the requisite key press" }, { names: ["-builtin", "-b"], @@ -761,25 +756,28 @@ var Mappings = Module("mappings", { yield { name: name, columns: [ - i === 0 ? "" : {mode.name}, - hive == mappings.builtin ? "" : {hive.name} + i === 0 ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" }, + mode.name], + hive == mappings.builtin ? "" : ["span", { highlight: "Object", style: "padding-right: 1em;" }, + hive.name] ], __proto__: map }; } }, format: { - description: function (map) (XML.ignoreWhitespace = false, XML.prettyPrinting = false, <> - {options.get("passkeys").has(map.name) - ? (passed by {template.helpLink("'passkeys'")}) - : <>} - {template.linkifyHelp(map.description + (map.rhs ? ": " + map.rhs : ""))} - ), + description: function (map) [ + options.get("passkeys").has(map.name) + ? ["span", { highlight: "URLExtra" }, + "(", template.linkifyHelp(_("option.passkeys.passedBy")), ")"] + : [], + 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 : "", headings: ["Command", "Mode", "Group", "Description"] } - } + }; dactyl.addUsageCommand({ __proto__: args, @@ -829,8 +827,8 @@ var Mappings = Module("mappings", { mappings: function initMappings(dactyl, modules, window) { mappings.add([modes.COMMAND], ["\\"], "Emits pseudo-key", - function () { events.feedkeys("") }); + function () { events.feedkeys(""); }); } }); -// vim: set fdm=marker sw=4 ts=4 et: +// vim: set fdm=marker sw=4 sts=4 ts=8 et: