1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 06:52:28 +01:00

hack-- for completions

This commit is contained in:
Martin Stubenschrott
2008-06-08 23:59:31 +00:00
parent ec91920bb8
commit 9b9a92e0cd
2 changed files with 11 additions and 17 deletions

View File

@@ -339,20 +339,10 @@ liberator.CommandLine = function () //{{{
["<Space>"], "Expand command line abbreviation",
function ()
{
// XXX: VERY ugly, hacky code, I know, but it fixes :side<tab><space><tab>
liberator.editor.expandAbbreviation("c");
var commandline = document.getElementById("liberator-commandline-command");
var txt = commandline.value;
var start = commandline.selectionStart;
commandline.value = txt.substr(0, start) + " " +
txt.substr(commandline.selectionEnd);
commandline.selectionStart = commandline.selectionEnd = start + 1;
var evt = window.document.createEvent("KeyEvents");
var view = window.document.defaultView;
evt.initKeyEvent("keypress", true, true, view, false, false, false, false, 0, 32);
liberator.commandline.onEvent(evt);
});
liberator.commandline.resetCompletions();
return liberator.editor.expandAbbreviation("c");
},
{ flags: liberator.Mappings.flags.ALLOW_EVENT_ROUTING });
liberator.mappings.add(modes,
["<C-]>", "<C-5>"], "Expand command line abbreviation",
@@ -748,8 +738,7 @@ liberator.CommandLine = function () //{{{
}
else // any other key
{
// reset the tab completion
completionIndex = historyIndex = UNINITIALIZED;
this.resetCompletions();
}
return true; // allow this event to be handled by Firefox
}
@@ -987,6 +976,11 @@ liberator.CommandLine = function () //{{{
}
},
resetCompletions: function ()
{
completionIndex = historyIndex = UNINITIALIZED;
},
// it would be better if we had a destructor in javascript ...
destroy: function ()
{