aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_page.html15
-rw-r--r--commands.js10
-rw-r--r--options.html2
3 files changed, 24 insertions, 3 deletions
diff --git a/background_page.html b/background_page.html
index 87b3c9ad..d98967b4 100644
--- a/background_page.html
+++ b/background_page.html
@@ -686,6 +686,21 @@
if (localStorage["keyMappings"])
parseCustomKeyMappings(localStorage["keyMappings"]);
+ // In version 1.22, we changed the mapping for "d" and "u" to be scroll page down/up instead of close
+ // and restore tab. For existing users, we want to preserve existing behavior for them by adding some
+ // custom key mappings on their behalf.
+ if (localStorage.previousVersion == "1.21") {
+ var customKeyMappings = localStorage["keyMappings"] || "";
+ if ((keyToCommandRegistry["d"] || {}).command == "scrollPageDown")
+ customKeyMappings += "\nmap d removeTab";
+ if ((keyToCommandRegistry["u"] || {}).command == "scrollPageUp")
+ customKeyMappings += "\nmap u restoreTab";
+ if (customKeyMappings != "") {
+ localStorage["keyMappings"] = customKeyMappings;
+ parseCustomKeyMappings(customKeyMappings);
+ }
+ }
+
populateValidFirstKeys();
populateSingleKeyCommands();
if (shouldShowUpgradeMessage())
diff --git a/commands.js b/commands.js
index f2b19467..de70a0a9 100644
--- a/commands.js
+++ b/commands.js
@@ -99,6 +99,12 @@ function clearKeyMappingsAndSetDefaults() {
"zL": "scrollToRight",
"<c-e>": "scrollDown",
"<c-y>": "scrollUp",
+
+ // scrollPageDown and scrollPageUp are mapped to two keys because they are very common actions so we
+ // want them to be mapped without a modifier key, but we also want to be faithful to Vim convention which
+ // has them on ctrl+D and ctrl+U.
+ "d": "scrollPageDown",
+ "u": "scrollPageUp",
"<c-d>": "scrollPageDown",
"<c-u>": "scrollPageUp",
"<c-f>": "scrollFullPageDown",
@@ -137,8 +143,8 @@ function clearKeyMappingsAndSetDefaults() {
"gT": "previousTab",
"t": "createTab",
- "d": "removeTab",
- "u": "restoreTab",
+ "x": "removeTab",
+ "X": "restoreTab",
"gf": "nextFrame"
};
diff --git a/options.html b/options.html
index 344fc01d..bfa01450 100644
--- a/options.html
+++ b/options.html
@@ -83,7 +83,7 @@
"userDefinedLinkHintCss", "keyMappings"];
var postSaveHooks = {
- "keyMappings": function (value) {
+ keyMappings: function (value) {
backgroundPage = chrome.extension.getBackgroundPage();
backgroundPage.clearKeyMappingsAndSetDefaults();
backgroundPage.parseCustomKeyMappings(value);