aboutsummaryrefslogtreecommitdiffstats
path: root/background_page.html
diff options
context:
space:
mode:
authorJez Ng2012-01-19 01:09:41 +0800
committerJez Ng2012-01-19 01:11:07 +0800
commit469acff29be41e60eb8e1c24f007d435711d2b50 (patch)
treee4282b6a903ee46ff8915ce5541fdfcdbdea7699 /background_page.html
parent5972613b7a0b7933d2736ea6190f652263ad37a3 (diff)
downloadvimium-469acff29be41e60eb8e1c24f007d435711d2b50.tar.bz2
Exit implicit insert mode only upon tab switch.
Don't do it when the user has merely switched windows.
Diffstat (limited to 'background_page.html')
-rw-r--r--background_page.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/background_page.html b/background_page.html
index b8516f1b..814c0687 100644
--- a/background_page.html
+++ b/background_page.html
@@ -18,6 +18,7 @@
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
@@ -307,6 +308,10 @@
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) {
@@ -428,6 +433,7 @@
chrome.windows.onRemoved.addListener(function(windowId) {
delete tabQueue[windowId];
+ delete lastActiveTabIds[windowId];
});
function restoreTab(callback) {