From 9b9a92e0cd31ce6742cc70252d87262708e43dc9 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Sun, 8 Jun 2008 23:59:31 +0000 Subject: [PATCH] hack-- for completions --- content/mail.js | 2 +- content/ui.js | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/content/mail.js b/content/mail.js index c95b97b2..f2bc31d0 100644 --- a/content/mail.js +++ b/content/mail.js @@ -100,7 +100,7 @@ liberator.Mail = function () //{{{ "Unread: " + folders[folder].getNumUnread(false)]); } - return [0, liberator.filter(completions, filter)]; + return [0, liberator.completion.filter(completions, filter)]; } function moveOrCopy(copy, destinationFolder, operateOnThread) diff --git a/content/ui.js b/content/ui.js index df5ff2ab..8dc74785 100644 --- a/content/ui.js +++ b/content/ui.js @@ -339,20 +339,10 @@ liberator.CommandLine = function () //{{{ [""], "Expand command line abbreviation", function () { - // XXX: VERY ugly, hacky code, I know, but it fixes :side - 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, ["", ""], "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 () {