mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 08:17: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);
|
||||
},
|
||||
{
|
||||
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)
|
||||
{
|
||||
var mfiltered = {};
|
||||
if (!filter)
|
||||
return macros;
|
||||
|
||||
var filtered = {};
|
||||
var re = new RegExp(filter);
|
||||
|
||||
for (var item in macros)
|
||||
{
|
||||
if (filter == null || item.indexOf(filter) != -1)
|
||||
mfiltered[item] = macros[item];
|
||||
if (item.match(re))
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user