diff --git a/src/main/java/net/sf/jabref/gui/keyboard/KeyBindingsListener.java b/src/main/java/net/sf/jabref/gui/keyboard/KeyBindingsListener.java index 110a026dd5a..b99e88da0dc 100644 --- a/src/main/java/net/sf/jabref/gui/keyboard/KeyBindingsListener.java +++ b/src/main/java/net/sf/jabref/gui/keyboard/KeyBindingsListener.java @@ -45,7 +45,7 @@ public void keyPressed(KeyEvent evt) { int code = evt.getKeyCode(); String newKey; //skip the event triggered only by a modifier - if(code == KeyEvent.VK_ALT || + if (code == KeyEvent.VK_ALT || code == KeyEvent.VK_TAB || code == KeyEvent.VK_BACK_SPACE || code == KeyEvent.VK_ENTER || @@ -54,12 +54,12 @@ public void keyPressed(KeyEvent evt) { code == KeyEvent.VK_SHIFT) { return; } - if("".equals(modifier)) { - if(isFunctionKey) { + if ("".equals(modifier)) { + if (isFunctionKey) { newKey = KeyEvent.getKeyText(code); - } else if(isEscapeKey) { + } else if (isEscapeKey) { newKey = "ESCAPE"; - } else if(isDeleteKey) { + } else if (isDeleteKey) { newKey = "DELETE"; } else { return; @@ -84,22 +84,21 @@ public void keyPressed(KeyEvent evt) { private String getModifierText(KeyEvent evt) { ArrayList modifiersList = new ArrayList<>(); - if (evt.isControlDown()) { - modifiersList.add("ctrl"); - } - if (evt.isAltDown()) { - modifiersList.add("alt"); - } - if (evt.isShiftDown()) { - modifiersList.add("shift"); - } - if (evt.isAltGraphDown()) { - modifiersList.add("alt gr"); - } - if (evt.isMetaDown()) { - modifiersList.add("meta"); - - } + if (evt.isControlDown()) { + modifiersList.add("ctrl"); + } + if (evt.isAltDown()) { + modifiersList.add("alt"); + } + if (evt.isShiftDown()) { + modifiersList.add("shift"); + } + if (evt.isAltGraphDown()) { + modifiersList.add("alt gr"); + } + if (evt.isMetaDown()) { + modifiersList.add("meta"); + } //Now build the String with all the modifier texts String modifiersAsString = ""; for (String s : modifiersList) {