From 7b1c40cf5f6a96cbfa0cac5c80babe5d36933b93 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 17 Feb 2011 10:11:04 -0500 Subject: [PATCH] Add AUTOCOMPLETE mode. --- common/content/events.js | 7 ++++++- common/content/modes.js | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/content/events.js b/common/content/events.js index 323cfa38..105c320a 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1258,7 +1258,11 @@ var Events = Module("events", { popupshown: function onPopupShown(event) { let elem = event.originalTarget; - if (elem.localName !== "tooltip" && elem.id !== "dactyl-visualbell") + if (elem instanceof Ci.nsIAutoCompletePopup) { + if (modes.main != modes.AUTOCOMPLETE) + modes.push(modes.AUTOCOMPLETE); + } + else if (elem.localName !== "tooltip") if (Events.isHidden(elem)) { if (elem.hidePopup && Events.isHidden(elem.parentNode)) elem.hidePopup(); @@ -1271,6 +1275,7 @@ var Events = Module("events", { // gContextMenu is set to NULL, when a context menu is closed if (window.gContextMenu == null && !this._activeMenubar) modes.remove(modes.MENU, true); + modes.remove(modes.AUTOCOMPLETE); }, resize: function onResize(event) { diff --git a/common/content/modes.js b/common/content/modes.js index 3e395e63..8a7fa43d 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -118,6 +118,11 @@ var Modes = Module("modes", { input: true, ownsFocus: true }); + this.addMode("AUTOCOMPLETE", { + description: "Active when an input autocomplete pop-up is active", + display: function () "INSERT (autocomplete)", + bases: [this.INSERT] + }); this.addMode("EMBED", { input: true,