diff options
| author | Jez Ng | 2012-01-19 01:09:41 +0800 |
|---|---|---|
| committer | Jez Ng | 2012-01-19 01:11:07 +0800 |
| commit | 469acff29be41e60eb8e1c24f007d435711d2b50 (patch) | |
| tree | e4282b6a903ee46ff8915ce5541fdfcdbdea7699 /background_page.html | |
| parent | 5972613b7a0b7933d2736ea6190f652263ad37a3 (diff) | |
| download | vimium-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.html | 6 |
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) { |
