mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-07 12:44:11 +01:00
Add group filtering to :abbreviation listings as documented.
--HG-- extra : rebase_source : 75004ff2c21e537b2128ce1f8aed078e1466aeff
This commit is contained in:
@@ -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 {Array} modes List of modes.
|
||||||
* @param {string} lhs The LHS of the abbreviation.
|
* @param {string} lhs The LHS of the abbreviation.
|
||||||
|
* @param {Hive[]} hives List of hives.
|
||||||
|
* @optional
|
||||||
*/
|
*/
|
||||||
list: function (modes, lhs) {
|
list: function (modes, lhs, hives) {
|
||||||
let hives = contexts.allGroups.abbrevs.filter(function (h) !h.empty);
|
let hives = hives || contexts.allGroups.abbrevs.filter(function (h) !h.empty);
|
||||||
|
|
||||||
function abbrevs(hive)
|
function abbrevs(hive)
|
||||||
hive.merged.filter(function (abbr) (abbr.inModes(modes) && abbr.lhs.indexOf(lhs) == 0));
|
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),
|
dactyl.assert(!args.length || abbreviations._check.test(lhs),
|
||||||
_("error.invalidArgument"));
|
_("error.invalidArgument"));
|
||||||
|
|
||||||
if (!rhs)
|
if (!rhs) {
|
||||||
abbreviations.list(modes, lhs || "");
|
let hives = args.explicitOpts["-group"] ? [args["-group"]] : null;
|
||||||
|
abbreviations.list(modes, lhs || "", hives);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (args["-javascript"])
|
if (args["-javascript"])
|
||||||
rhs = contexts.bindMacro({ literalArg: rhs }, "-javascript", ["editor"]);
|
rhs = contexts.bindMacro({ literalArg: rhs }, "-javascript", ["editor"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user