Skip to content

Commit

Permalink
Focus search bar after toggling search flags (#11857)
Browse files Browse the repository at this point in the history
  • Loading branch information
LoayGhreeb authored Sep 30, 2024
1 parent 38bcb81 commit a47b338
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,25 @@ private void initSearchModifierButtons() {
} else {
searchPreferences.setSearchFlag(SearchFlags.FULLTEXT, newVal);
}
searchField.requestFocus();
updateSearchQuery();
});

keepSearchString.setSelected(searchPreferences.shouldKeepSearchString());
keepSearchString.setTooltip(new Tooltip(Localization.lang("Keep search string across libraries")));
initSearchModifierButton(keepSearchString);
keepSearchString.selectedProperty().addListener((obs, oldVal, newVal) -> searchPreferences.setKeepSearchString(newVal));
keepSearchString.selectedProperty().addListener((obs, oldVal, newVal) -> {
searchPreferences.setKeepSearchString(newVal);
searchField.requestFocus();
});

filterModeButton.setSelected(searchPreferences.getSearchDisplayMode() == SearchDisplayMode.FILTER);
filterModeButton.setTooltip(new Tooltip(Localization.lang("Filter search results")));
initSearchModifierButton(filterModeButton);
filterModeButton.setOnAction(event -> searchPreferences.setSearchDisplayMode(filterModeButton.isSelected() ? SearchDisplayMode.FILTER : SearchDisplayMode.FLOAT));
filterModeButton.setOnAction(event -> {
searchPreferences.setSearchDisplayMode(filterModeButton.isSelected() ? SearchDisplayMode.FILTER : SearchDisplayMode.FLOAT);
searchField.requestFocus();
});

openGlobalSearchButton.disableProperty().bindBidirectional(globalSearchActive);
openGlobalSearchButton.setTooltip(new Tooltip(Localization.lang("Search across libraries in a new window")));
Expand Down

0 comments on commit a47b338

Please sign in to comment.