1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 06:17:58 +01:00

cleaned up completion.js a lot, probaby still something to do

This commit is contained in:
Martin Stubenschrott
2008-06-08 04:01:56 +00:00
parent 1742c9cd44
commit 6ecd478298
7 changed files with 202 additions and 252 deletions

View File

@@ -89,7 +89,10 @@ liberator.AutoCommands = function () //{{{
}
},
{
completer: function (filter) { return liberator.completion.autocommands(filter); }
completer: function (filter)
{
return [0, liberator.completion.filter(liberator.config.autocommands || [], filter)];
}
});
/////////////////////////////////////////////////////////////////////////////}}}
@@ -386,6 +389,16 @@ liberator.Events = function () //{{{
return 0;
}
function getMacroCompletions(filter)
{
var macros = [];
var tmp = liberator.events.getMacros();
for (var item in tmp)
macros.push([item, tmp[item]]);
return [0, liberator.completion.filter(macros, filter)];
}
function isFormElemFocused()
{
var elt = window.document.commandDispatcher.focusedElement;
@@ -587,6 +600,9 @@ liberator.Events = function () //{{{
liberator.echoerr("E474: Invalid argument");
else
liberator.events.deleteMacros(arg);
},
{
completer: function (filter) { return getMacroCompletions(filter); }
});
liberator.commands.add(["macros"],
@@ -602,6 +618,9 @@ liberator.Events = function () //{{{
str += "</table>";
liberator.echo(str, liberator.commandline.FORCE_MULTILINE);
},
{
completer: function (filter) { return getMacroCompletions(filter); }
});
liberator.commands.add(["pl[ay]"],
@@ -614,7 +633,7 @@ liberator.Events = function () //{{{
liberator.events.playMacro(arg);
},
{
completer: function (filter) { return liberator.completion.macros(filter); }
completer: function (filter) { return getMacroCompletions(filter); }
});
/////////////////////////////////////////////////////////////////////////////}}}