Skip to content

Commit

Permalink
Fix mac keybinding by replacing ctrl it with meta key (#3000)
Browse files Browse the repository at this point in the history
Remoce spaces
  • Loading branch information
Siedlerchr authored Jul 12, 2017
1 parent e35b6ac commit f23db0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ public KeyStroke getKey(KeyBinding bindName) {

private KeyCombination getKeyCombination(KeyBinding bindName) {
String binding = get(bindName.getConstant());
if (OS.OS_X) {
binding = binding.replace("ctrl", "meta");
}

return KeyCombination.valueOf(binding);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
Expand Down Expand Up @@ -175,13 +174,10 @@ public void testSetSingleKeyBindingToDefault() {

@Test
public void testConversionAwtKeyEventJavafxKeyEvent() {


java.awt.event.KeyEvent evt = new java.awt.event.KeyEvent(mock(JFrame.class), 0, 0, InputEvent.CTRL_MASK, java.awt.event.KeyEvent.VK_S, java.awt.event.KeyEvent.CHAR_UNDEFINED);

Optional<KeyBinding> keyBinding = keyBindingRepository.mapToKeyBinding(evt);
assertEquals(Optional.of(KeyBinding.SAVE_DATABASE), keyBinding);

}

private KeyBindingViewModel setKeyBindingViewModel(KeyBinding binding) {
Expand Down

0 comments on commit f23db0e

Please sign in to comment.