mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:37:59 +01:00
regex instead of string compare on :macros and :macrosdump
This commit is contained in:
@@ -1453,7 +1453,9 @@ vimperator.Commands = function () //{{{
|
|||||||
vimperator.echo(str, vimperator.commandline.FORCE_MULTILINE);
|
vimperator.echo(str, vimperator.commandline.FORCE_MULTILINE);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
shortHelp: "List macros matching the argument; or all macros if no argument is given."
|
usage: ["mac[ros] [regex]"],
|
||||||
|
shortHelp: "List macros matching a regex",
|
||||||
|
help: "List recorded macros matching the optional regular expression. If no regex is given, list all."
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -541,13 +541,18 @@ vimperator.Events = function () //{{{
|
|||||||
|
|
||||||
getMacros: function (filter)
|
getMacros: function (filter)
|
||||||
{
|
{
|
||||||
var mfiltered = {};
|
if (!filter)
|
||||||
|
return macros;
|
||||||
|
|
||||||
|
var filtered = {};
|
||||||
|
var re = new RegExp(filter);
|
||||||
|
|
||||||
for (var item in macros)
|
for (var item in macros)
|
||||||
{
|
{
|
||||||
if (filter == null || item.indexOf(filter) != -1)
|
if (item.match(re))
|
||||||
mfiltered[item] = macros[item];
|
filtered[item] = macros[item];
|
||||||
}
|
}
|
||||||
return mfiltered; //XXX: returns a real copy, since this is only a 'var ..'?
|
return filtered; //XXX: returns a real copy, since this is only a 'var ..'?
|
||||||
},
|
},
|
||||||
|
|
||||||
// This method pushes keys into the event queue from vimperator
|
// This method pushes keys into the event queue from vimperator
|
||||||
|
|||||||
Reference in New Issue
Block a user