diff options
author | Pascal Krause <pascal.krause@sap.com> | 2016-02-15 17:12:00 +0100 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2016-02-19 00:48:46 +0000 |
commit | 5f37a9fca05cf06528da885437f70557d5eea2b5 (patch) | |
tree | 0c2fb60aa79c0c2ebd2648bc67861e86cb4e32c0 | |
parent | 9e329325de3608b1103c88e463091e3f59c31e86 (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.java | 9 | ||||
-rw-r--r-- | gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java | 4 |
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 8b47835404..6e992b94d1 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 @@ -368,8 +368,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)) |