diff options
| author | Jez Ng | 2012-02-26 23:47:57 -0500 |
|---|---|---|
| committer | Jez Ng | 2012-02-26 23:47:57 -0500 |
| commit | 18d5b9f6c44f6245f01a19471a475d6fb9775fe9 (patch) | |
| tree | d90036ae4ae5fa303ad38cde6d461ed1cd4eb6fa | |
| parent | 448b96a82b8877d07e922d6cbad84210a423bfe5 (diff) | |
| download | vimium-18d5b9f6c44f6245f01a19471a475d6fb9775fe9.tar.bz2 | |
Revert "Exit implicit insert mode only upon tab switch."
This reverts commit 469acff29be41e60eb8e1c24f007d435711d2b50.
Conflicts:
vimiumFrontend.js
| -rw-r--r-- | background_page.html | 6 | ||||
| -rw-r--r-- | vimiumFrontend.js | 17 |
2 files changed, 7 insertions, 16 deletions
diff --git a/background_page.html b/background_page.html index 90c628dc..aca4206b 100644 --- a/background_page.html +++ b/background_page.html @@ -14,7 +14,6 @@ var singleKeyCommands = []; var focusedFrame = null; var framesForTab = {}; - var lastActiveTabIds = {}; // Keys are either literal characters, or "named" - for example <a-b> (alt+b), <left> (left arrow) or <f12> // This regular expression captures two groups: the first is a named key, the second is the remainder of @@ -273,10 +272,6 @@ chrome.tabs.onSelectionChanged.addListener(function(tabId, selectionInfo) { if (selectionChangedHandlers.length > 0) { selectionChangedHandlers.pop().call(); } - - if (lastActiveTabIds[selectionInfo.windowId] !== undefined) - chrome.tabs.sendRequest(lastActiveTabIds[selectionInfo.windowId], { name: "exitImplicitInsertMode" }); - lastActiveTabIds[selectionInfo.windowId] = tabId; }); function repeatFunction(func, totalCount, currentCount, frameId) { @@ -398,7 +393,6 @@ chrome.windows.onRemoved.addListener(function(windowId) { delete tabQueue[windowId]; - delete lastActiveTabIds[windowId]; }); function restoreTab(callback) { diff --git a/vimiumFrontend.js b/vimiumFrontend.js index f62e450f..286dfe3e 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -135,11 +135,6 @@ function initializePreDomReady() { focusThisFrame(request.highlight); } else if (request.name == "refreshCompletionKeys") { refreshCompletionKeys(request); - } else if (request.name == "exitImplicitInsertMode") { - if (!HUD.isShowing) { - document.activeElement.blur(); - exitInsertMode(); - } } sendResponse({}); // Free up the resources used by this open connection. }); @@ -193,7 +188,7 @@ function initializeWhenEnabled() { document.addEventListener("keypress", onKeypress, true); document.addEventListener("keyup", onKeyup, true); document.addEventListener("focus", onFocusCapturePhase, true); - document.addEventListener("blur", onBlurCapturePhase, true); + window.addEventListener("blur", onBlurCapturePhase, true); document.addEventListener("DOMActivate", onDOMActivate, true); enterInsertModeIfElementIsFocused(); } @@ -568,7 +563,12 @@ function onFocusCapturePhase(event) { } function onBlurCapturePhase(event) { - if (isFocusable(event.target)) + if (event.target == window) + // At this point, we will have exited insert mode already, but the browser remembers which element last + // had focus, and fires a focus event on it when the window regains focus. We blur this element to prevent + // implicit insert mode from reactivating when we switch back to this tab. + document.activeElement.blur(); + else if (isFocusable(event.target)) exitInsertMode(event.target); } @@ -1009,7 +1009,6 @@ HUD = { _tweenId: -1, _displayElement: null, _upgradeNotificationElement: null, - isShowing: false, // This HUD is styled to precisely mimick the chrome HUD on Mac. Use the "has_popup_and_link_hud.html" // test harness to tweak these styles to match Chrome's. One limitation of our HUD display is that @@ -1027,7 +1026,6 @@ HUD = { clearInterval(HUD._tweenId); HUD._tweenId = Tween.fade(HUD.displayElement(), 1.0, 150); HUD.displayElement().style.display = ""; - this.isShowing = true; }, showUpgradeNotification: function(version) { @@ -1088,7 +1086,6 @@ HUD = { else HUD._tweenId = Tween.fade(HUD.displayElement(), 0, 150, function() { HUD.displayElement().style.display = "none"; }); - this.isShowing = false; }, isReady: function() { return document.body != null; }, |
