From 51a55b48a98e41cff6be0f61724da5bfb1adbd9b Mon Sep 17 00:00:00 2001 From: Dominik Voigt Date: Wed, 25 Nov 2020 14:01:11 +0100 Subject: [PATCH] Fix binding issue for the regex and case sensitive search buttons Signed-off-by: Dominik Voigt --- .../java/org/jabref/gui/search/GlobalSearchBar.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java index 9cc91baeee2..67f19778048 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java @@ -126,13 +126,16 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager, Preferences // searchModeButton = new Button(); initSearchModifierButtons(); - BooleanBinding focusBinding = searchField.focusedProperty() - .or(regularExpressionButton.focusedProperty() - .or(caseSensitiveButton.focusedProperty())); + BooleanBinding focusedOrActive = searchField.focusedProperty() + .or(regularExpressionButton.focusedProperty()) + .or(caseSensitiveButton.focusedProperty()) + .or(searchField.textProperty() + .isNotEmpty()); + regularExpressionButton.visibleProperty().unbind(); - regularExpressionButton.visibleProperty().bind(focusBinding); + regularExpressionButton.visibleProperty().bind(focusedOrActive); caseSensitiveButton.visibleProperty().unbind(); - caseSensitiveButton.visibleProperty().bind(focusBinding); + caseSensitiveButton.visibleProperty().bind(focusedOrActive); StackPane modifierButtons = new StackPane(new HBox(regularExpressionButton, caseSensitiveButton)); modifierButtons.setAlignment(Pos.CENTER);