Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- Enhanced field selection logic in the Merge Entries dialog when fetching from DOI to prefer valid years and entry types. [#12549](https://github.com/JabRef/jabref/issues/12549)
- We fixed an issue where theme or font size are not respected for all dialogs [#13558](https://github.com/JabRef/jabref/issues/13558)
- We removed unnecessary spacing and margin in the AutomaticFieldEditor. [#13792](https://github.com/JabRef/jabref/pull/13792)
- We fixed an issue where global search auto-completion only worked after switching tabs. [#11428](https://github.com/JabRef/jabref/issues/11428)

### Removed

Expand Down
11 changes: 10 additions & 1 deletion jabgui/src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ public class LibraryTab extends Tab implements CommandSelectionTab {

private final AiService aiService;

private Runnable autoCompleterChangedListener;

/**
* @param isDummyContext Indicates whether the database context is a dummy. A dummy context is used to display a progress indicator while parsing the database.
* If the context is a dummy, the Lucene index should not be created, as both the dummy context and the actual context share the same index path {@link BibDatabaseContext#getFulltextIndexPath()}.
Expand Down Expand Up @@ -258,6 +260,10 @@ private void initializeComponentsAndListeners(boolean isDummyContext) {
});
}

public void setAutoCompleterChangedListener(@NonNull Runnable listener) {
this.autoCompleterChangedListener = listener;
}

private static void addChangedInformation(StringBuilder text) {
text.append("\n");
text.append(Localization.lang("The library has been modified."));
Expand Down Expand Up @@ -303,7 +309,10 @@ private void onDatabaseLoadingSucceed(ParserResult result) {
}

setDatabaseContext(result.getDatabaseContext());

// Notify listeners that the auto-completer may have changed
if (autoCompleterChangedListener != null) {
autoCompleterChangedListener.run();
}
LOGGER.trace("loading.set(false);");
loading.set(false);
dataLoadingTask = null;
Expand Down
3 changes: 3 additions & 0 deletions jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ private void initBindings() {
stateManager.searchResultSize(SearchType.NORMAL_SEARCH).bind(libraryTab.resultSizeProperty());
globalSearchBar.setAutoCompleter(libraryTab.getAutoCompleter());

// Listen for auto-completer changes after real context is loaded
libraryTab.setAutoCompleterChangedListener(() -> globalSearchBar.setAutoCompleter(libraryTab.getAutoCompleter()));

// [impl->req~maintable.focus~1]
Platform.runLater(() -> libraryTab.getMainTable().requestFocus());

Expand Down
Loading