Skip to content

Commit

Permalink
[feat] Ctrl+a and Ctrl+f can now also be toggled in preferences
Browse files Browse the repository at this point in the history
There are sub-options deciding whether C-a and C-f  should be rebinded as well, which now work as intended

[Issue: #9]
  • Loading branch information
krisgun committed Feb 26, 2020
1 parent 3752711 commit 48c3777
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ private void openWindow(Stage mainStage) {
KeyBindingRepository keyBindingRepository = Globals.getKeyPrefs();
TextField focusedTextField = (TextField) scene.focusOwnerProperty().get();
Optional<KeyBinding> keyBinding = keyBindingRepository.mapToKeyBinding(event);
boolean CAFlag = Globals.prefs.getBoolean(JabRefPreferences.EDITOR_EMACS_KEYBINDINGS_REBIND_CA);
boolean CFFlag = Globals.prefs.getBoolean(JabRefPreferences.EDITOR_EMACS_KEYBINDINGS_REBIND_CF);
if (keyBinding.isPresent()) {
if (keyBinding.get().equals(KeyBinding.EMACS_DELETE)) {
focusedTextField.deletePreviousChar();
Expand All @@ -108,11 +110,11 @@ else if (keyBinding.get().equals(KeyBinding.EMACS_BACKWARD)) {
focusedTextField.backward();
event.consume();
}
else if (keyBinding.get().equals(KeyBinding.EMACS_FORWARD)) {
else if (CFFlag && keyBinding.get().equals(KeyBinding.EMACS_FORWARD)) {
focusedTextField.forward();
event.consume();
}
else if (keyBinding.get().equals(KeyBinding.EMACS_BEGINNING)) {
else if (CAFlag && keyBinding.get().equals(KeyBinding.EMACS_BEGINNING)) {
focusedTextField.home();
event.consume();
}
Expand Down

0 comments on commit 48c3777

Please sign in to comment.