diff --git a/CHANGELOG.md b/CHANGELOG.md index 91fc3245e5c..742b1436e78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Changed +- We changed the setting of the keyword separator to accept a single character only. [#177](https://github.com/koppor/jabref/issues/177) + ### Fixed ### Removed diff --git a/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java b/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java index f92088ad6ea..ecdbd6aefc0 100644 --- a/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java +++ b/src/main/java/org/jabref/gui/preferences/entry/EntryTab.java @@ -1,9 +1,12 @@ package org.jabref.gui.preferences.entry; +import java.util.function.UnaryOperator; + import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.TextField; +import javafx.scene.control.TextFormatter; import org.jabref.gui.actions.ActionFactory; import org.jabref.gui.actions.StandardActions; @@ -48,6 +51,17 @@ public void initialize() { keywordSeparator.textProperty().bindBidirectional(viewModel.keywordSeparatorProperty()); + // Use TextFormatter to limit the length of the Input of keywordSeparator to 1 character only. + UnaryOperator singleCharacterFilter = change -> { + if (change.getControlNewText().length() <= 1) { + return change; + } + return null; // null means the change is rejected + }; + TextFormatter formatter = new TextFormatter<>(singleCharacterFilter); + + keywordSeparator.setTextFormatter(formatter); + resolveStrings.selectedProperty().bindBidirectional(viewModel.resolveStringsProperty()); resolveStringsForFields.textProperty().bindBidirectional(viewModel.resolveStringsForFieldsProperty()); nonWrappableFields.textProperty().bindBidirectional(viewModel.nonWrappableFieldsProperty());