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
This commit is contained in:
Pascal Krause 2016-02-15 17:12:00 +01:00 committed by David Pursehouse
parent c335b6808c
commit 04610c1899
2 changed files with 2 additions and 11 deletions

View File

@ -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;
}
}

View File

@ -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))