Skip to content

Commit

Permalink
Merge pull request #12817 from Cattlesquat/KeyConfigurerFix
Browse files Browse the repository at this point in the history
12817 - Fix alphanumeric key behavior in hotkey (key command) configurer in Editor (e.g., Shift+B should show up as "Shift+B", not "B")
  • Loading branch information
uckelman authored Oct 16, 2023
2 parents f0617be + 5856e69 commit d94800b
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,33 +418,33 @@ public void keyPressed(KeyEvent e) {
}

// Repeat the Key handling for each Key of interest on release.
// This has no effect on Windows, but caters for the bizarre
// KeyEvent sequences created on MacOS.
// Caters for the bizarre KeyEvent sequences created on MacOS.
// ALSO, it turn sout, makes alphanumeric keys record properly on Windows
@Override
public void keyReleased(KeyEvent e) {
// reportKeyEvent("KEY_RELEASED", e); // NON-NLS
if (SystemUtils.IS_OS_MAC) {
switch (e.getKeyCode()) {
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
switch (e.getKeyCode()) {
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
if (SystemUtils.IS_OS_MAC) {
// Allow mapping of Delete
if (getValue().equals(NamedKeyStroke.NULL_KEYSTROKE) || e.isShiftDown() || e.isControlDown() || e.isMetaDown() || e.isAltDown()) {
setValue(NamedKeyStroke.of(SwingUtils.convertKeyEvent(e)));
}
else {
setValue(NamedKeyStroke.NULL_KEYSTROKE);
}
break;
case KeyEvent.VK_SHIFT:
case KeyEvent.VK_CONTROL:
case KeyEvent.VK_META:
case KeyEvent.VK_ALT:
case KeyEvent.VK_ALT_GRAPH:
case KeyEvent.VK_UNDEFINED:
break;
default:
setValue(NamedKeyStroke.of(SwingUtils.convertKeyEvent(e)));
}
break;
case KeyEvent.VK_SHIFT:
case KeyEvent.VK_CONTROL:
case KeyEvent.VK_META:
case KeyEvent.VK_ALT:
case KeyEvent.VK_ALT_GRAPH:
case KeyEvent.VK_UNDEFINED:
break;
default:
setValue(NamedKeyStroke.of(SwingUtils.convertKeyEvent(e)));
}
}
}
Expand Down

0 comments on commit d94800b

Please sign in to comment.