From 6f1bbfbd29c19459ca3678f3f66200eb6bce9eb1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 20 Jul 2011 15:47:04 +1000 Subject: [PATCH] Add group filtering to :abbreviation listings as documented. --HG-- extra : rebase_source : 75004ff2c21e537b2128ce1f8aed078e1466aeff --- common/content/abbreviations.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index e079cc05..313dae21 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -249,13 +249,15 @@ var Abbreviations = Module("abbreviations", { }, /** - * Lists all abbreviations matching *modes* and *lhs*. + * Lists all abbreviations matching *modes*, *lhs*, and optionally *hives*. * * @param {Array} modes List of modes. * @param {string} lhs The LHS of the abbreviation. + * @param {Hive[]} hives List of hives. + * @optional */ - list: function (modes, lhs) { - let hives = contexts.allGroups.abbrevs.filter(function (h) !h.empty); + list: function (modes, lhs, hives) { + let hives = hives || contexts.allGroups.abbrevs.filter(function (h) !h.empty); function abbrevs(hive) hive.merged.filter(function (abbr) (abbr.inModes(modes) && abbr.lhs.indexOf(lhs) == 0)); @@ -317,8 +319,10 @@ var Abbreviations = Module("abbreviations", { dactyl.assert(!args.length || abbreviations._check.test(lhs), _("error.invalidArgument")); - if (!rhs) - abbreviations.list(modes, lhs || ""); + if (!rhs) { + let hives = args.explicitOpts["-group"] ? [args["-group"]] : null; + abbreviations.list(modes, lhs || "", hives); + } else { if (args["-javascript"]) rhs = contexts.bindMacro({ literalArg: rhs }, "-javascript", ["editor"]);