summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Krause <pascal.krause@sap.com>2016-02-15 17:12:00 +0100
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-03-08 10:24:06 +0900
commit04610c1899ed47110fe8a56f1df84f371530f7af (patch)
tree10969c7e51be51fef746dd9fd15b06ef96ac6a7e
parentc335b6808cac4f52f31d784692040f84fe36361b (diff)
Fix keyboard shortcuts for non-US keyboards
The forward/backward navigation keys "[" and "]" worked only on those keyboards where these characters could be typed without using any modifier key (like CTRL, ALT, etc..). For example, on German keyboard the "[" is entered as ALTGR+8. Webkit browsers translate the ALTGR modifier into CTRL+ALT (This seems not to be true in Linux. Because of this fact, this change doesn't have any effect on Linux). Further, our code in gwtexpui checks for CTRL and ALT keys and modifies the entered key accordingly. Therefore, the "[" typed on German keyboard gets modified to some other key. This change removes the special processing of CTRL and ALT key modifiers and makes the "[", "]" and likely a few other keys work on German (and likely other) keyboard. A further issue with the "[" and "]" keys is when the focus is inside codemirror. CM detects the keys correctly, but when CM lookup for a key handler in the keymap it wrap the key into two "'". Because of this CM looks for a key with the value "'['" or "']'". But in SideBySide.java the keys were defined as "[" and "]". So CM couldn't find the defined key handler and used other CM native handlers for these keys. Bug: issue 1207 Change-Id: I8e7d552b3927047b31ced373eafac3436a70b277
-rw-r--r--gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java9
-rw-r--r--gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java4
2 files changed, 2 insertions, 11 deletions
diff --git a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java
index e2fec27a45..26252226d7 100644
--- a/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java
+++ b/gerrit-gwtexpui/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java
@@ -136,15 +136,6 @@ public class KeyCommandSet implements KeyPressHandler {
if (mask == 0) {
mask = event.getNativeEvent().getKeyCode();
}
- if (event.isAltKeyDown()) {
- mask |= KeyCommand.M_ALT;
- }
- if (event.isControlKeyDown()) {
- mask |= KeyCommand.M_CTRL;
- }
- if (event.isMetaKeyDown()) {
- mask |= KeyCommand.M_META;
- }
return mask;
}
}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java
index 4f634252ed..0894ed8406 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java
@@ -367,8 +367,8 @@ public class SideBySide extends Screen {
KeyMap keyMap = KeyMap.create()
.on("A", upToChange(true))
.on("U", upToChange(false))
- .on("[", header.navigate(Direction.PREV))
- .on("]", header.navigate(Direction.NEXT))
+ .on("'['", header.navigate(Direction.PREV))
+ .on("']'", header.navigate(Direction.NEXT))
.on("R", header.toggleReviewed())
.on("O", commentManager.toggleOpenBox(cm))
.on("Enter", commentManager.toggleOpenBox(cm))