X-Git-Url: https://git.donarmstrong.com/?p=dactyl.git;a=blobdiff_plain;f=common%2Fcontent%2Fabbreviations.js;h=4b646446aa607139f3c151137b818571d8f8eb72;hp=08294970d684e4e6541513620430f99c9129e4d7;hb=8b6fcae7eaa413bc62d645d2d0c99835c47265e6;hpb=5ebd29f56d17f62011cdd596b1d351947ee534ff diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 0829497..4b64644 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -1,10 +1,10 @@ // Copyright (c) 2006-2009 by Martin Stubenschrott // Copyright (c) 2010 by anekos -// Copyright (c) 2010-2011 by Kris Maglione +// Copyright (c) 2010-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 */ @@ -213,18 +213,18 @@ var Abbreviations = Module("abbreviations", { nonkeyword: /[ "']/ }; - this._match = util.regexp(<>) (+ )$ | // full-id (^ | \s | ) (+ )$ | // end-id (^ | \s ) (\S* )$ // non-id - ]]>, "x", params); - this._check = util.regexp(<>+ | // full-id + | // end-id \S* // non-id ) $ - ]]>, "x", params); + */), "x", params); }, get: deprecated("group.abbrevs.get", { get: function get() this.user.closure.get }), @@ -262,33 +262,29 @@ var Abbreviations = Module("abbreviations", { function abbrevs(hive) hive.merged.filter(function (abbr) (abbr.inModes(modes) && abbr.lhs.indexOf(lhs) == 0)); - let list = - - - - - - - { - template.map(hives, function (hive) let (i = 0) - + - template.map(abbrevs(hive), function (abbrev) - - - - - - ) + - ) - } -
- {_("title.Mode")}{_("title.Abbrev")}{_("title.Replacement")}
{!i++ ? hive.name : ""}{abbrev.modeChar}{abbrev.lhs}{abbrev.rhs}
; - - // TODO: Move this to an ItemList to show this automatically - if (list.*.length() === list.text().length() + 2) - dactyl.echomsg(_("abbreviation.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.Abbrev")], + ["td", { style: "padding-right: 1em;" }, _("title.Replacement")]], + ["col", { style: "min-width: 6em; padding-right: 1em;" }], + hives.map(function (hive) let (i = 0) [ + ["tr", { style: "height: .5ex;" }], + abbrevs(hive).map(function (abbrev) + ["tr", {}, + ["td", { highlight: "Title" }, !i++ ? String(hive.name) : ""], + ["td", {}, abbrev.modeChar], + ["td", {}, abbrev.lhs], + ["td", {}, abbrev.rhs]]), + ["tr", { style: "height: .5ex;" }]])]; + + // FIXME? + // // TODO: Move this to an ItemList to show this automatically + // if (list.*.length() === list.text().length() + 2) + // dactyl.echomsg(_("abbreviation.none")); + // else + commandline.commandOutput(list); } }, { @@ -299,7 +295,7 @@ var Abbreviations = Module("abbreviations", { user: contexts.hives.abbrevs.user }); }, - completion: function () { + completion: function initCompletion() { completion.abbreviation = function abbreviation(context, modes, group) { group = group || abbreviations.user; let fn = modes ? function (abbr) abbr.inModes(modes) : util.identity; @@ -307,7 +303,7 @@ var Abbreviations = Module("abbreviations", { context.completions = group.merged.filter(fn); }; }, - commands: function () { + commands: function initCommands() { function addAbbreviationCommands(modes, ch, modeDescription) { modes.sort(); modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";