From 201e52bc992c94e1964ec6d4aaadff6e4096c2f8 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 9 Mar 2010 21:41:10 -0800 Subject: Refresh completion keys on all tabs and associated data structures after key mappings are saved. --- background_page.html | 10 ++++++++++ options.html | 1 + vimiumFrontend.js | 2 ++ 3 files changed, 13 insertions(+) diff --git a/background_page.html b/background_page.html index 6ec9f2af..978409bd 100644 --- a/background_page.html +++ b/background_page.html @@ -367,6 +367,16 @@ } } + function refreshCompletionKeysAfterMappingSave() { + validFirstKeys = {}; + singleKeyCommands = []; + + populateValidFirstKeys(); + populateSingleKeyCommands(); + + sendRequestToAllTabs({ name: "refreshCompletionKeys", completionKeys: generateCompletionKeys() }); + } + /* * Generates a list of keys that can complete a valid command given the current key queue or the one passed * in. diff --git a/options.html b/options.html index 429fe3ea..6e6b1bc3 100644 --- a/options.html +++ b/options.html @@ -77,6 +77,7 @@ backgroundPage = chrome.extension.getBackgroundPage(); backgroundPage.clearKeyMappingsAndSetDefaults(); backgroundPage.parseCustomKeyMappings(value); + backgroundPage.refreshCompletionKeysAfterMappingSave(); } }; diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 229da7e3..a5b50e6a 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -62,6 +62,8 @@ function initializePreDomReady() { HUD.showUpgradeNotification(request.version); else if (request.name == "showHelpDialog") showHelpDialog(request.dialogHtml); + else if (request.name == "refreshCompletionKeys") + refreshCompletionKeys(request.completionKeys); sendResponse({}); // Free up the resources used by this open connection. }); -- cgit v1.2.3