-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for issue 11428: auto-completion in search bar now works without tab switching #12060
Conversation
The fix ensures that the auto-completion is set up correctly when a database is initially opened, using `Platform.runLater` to ensure that the completion binder is updated in the next event loop cycle Issue: JabRef#11428 See: JabRef#11428
Hm, I tested your PR and for me under mac it still does only work when I switch tabs However, in the debugger I see that the setup code is executed, but it still does not work |
Thank you for your feedback. I'm very sorry that I didn't test my code on a Mac before. I will check the problem based on what you said. |
The same behavior occurs on Windows: if you open Unfortunately, the changes you made won't solve the problem because the main issue lies with the dummy database context. Here's the current flow:
I hope this flow helps in identifying the root cause of the issue. In my opinion, the real fix would be to replace the dummy context logic and create the tab only after the loading task finishes. As a hotfix, I think adding |
Thank you very much for your detailed feedback. I am very sorry that I did not notice the Chocolate.bib file before. I was using other bib format files. I will refer to the process you gave, check and modify the code. |
Closing this issue due to inactivity 💤 |
Purpose
see #11428
The fix ensures that the auto-completion is set up correctly when a database is initially opened, using
Platform.runLater
to ensure that the completion binder is updated in the next event loop cycle.closes #11428
Description
I pulled the latest version 5.15 on Windows 11, and the issue still persists.
The root cause lies in the jabref/src/main/java/org/jabref/gui/frame/JabRefFrame.java, specifically in the initBindings() method.
The code responsible for updating the search auto-completion (globalSearchBar.setAutoCompleter(libraryTab.getAutoCompleter());) is placed inside a listener that only triggers when the user switches between tabs (Lines 363-383 in 8cf8959). This leads to the bug where the auto-completion is not activated when opening a database for the first time.
Solution
I noticed that there is another listener in the initBindings() method, responsible for handling the selected tab and executing corresponding operations. By placing the globalSearchBar.setAutoCompleter(libraryTab.getAutoCompleter()); inside this listener, the problem can be resolved. Whether the user opens a new database tab or switches to an already open one, this listener gets triggered since both actions select a tab. As a result, this ensures that the search bar auto-completion gets updated appropriately.
Outcome
Since the JabRefFrame class is part of the UI, it is not suitable for code-based testing. Therefore, I have attached relevant screenshots below for reference.
Figure 1: Type sm and the auto-complete pop-up window will appear.
Figure 2: I opened a new database and the autocomplete popup is still active.
Figure 3: I switched to the first database and the auto-completion feature still works.
Issue to be clarified
There seems to be a problem with the auto-completion logic. I'm not sure if it's because my testing method is wrong (to be honest, I don't really understand the auto-completion logic), or if this problem is related to the current search being restructured.
This problem mainly occurs when I only enter the first letter of the name, and the completion information given is inaccurate, such as Figure 2.
I think it may not be a problem with my code, because I used the version of the code in main branch (8cf8959) to test, and found that only the first letter of the name is entered, and the same problem as Figure 3 and the following problem will appear.
Sometimes when I enter the first two letters of a name, it doesn’t give 100% accurate completion information, such as the screenshot below
@LoayGhreeb if possible, could you please take a look into this? I would greatly appreciate your help in identifying the cause. Thank you so much!
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)