Skip to content

Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard #13633

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ankamde
Copy link
Contributor

@ankamde ankamde commented Aug 2, 2025

Closes #13597

Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard

Steps to test

Copy following to your clipboard:

@Article{,
author = {Oliver Kopp and Carl Christian Snethlage and Christoph Schwentker},
journal = {TUGboat},
title = {JabRef: BibTeX-based literature management software},
year = {2023},
issn = {0896-3207},
number = {3},
pages = {441--447},
volume = {44},
issue = {138},
ranking = {rank4},
}
Click on the "Add entry using..." button

Specify Bib(La)TeX tab is automatically selected:

image

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@@ -164,6 +167,8 @@ private void finalizeTabs() {
approach = NewEntryDialogTab.ENTER_IDENTIFIER;
interpretText.setText(clipboardText);
interpretText.selectAll();
} else if (clipboardText.split(LINE_BREAK)[0].matches(BIBTEX_REGEX)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct array access without bounds checking could lead to ArrayIndexOutOfBoundsException if clipboardText is empty. Should use Optional or safe array access pattern.

Copy link
Contributor Author

@ankamde ankamde Aug 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text won't be empty - if check in line 164 ensures this.

@ankamde ankamde marked this pull request as ready for review August 2, 2025 12:29
@ankamde
Copy link
Contributor Author

ankamde commented Aug 6, 2025

@koppor Hi, this one is ready for review. Build failed but nothing related to my changes.

Copy link

trag-bot bot commented Aug 6, 2025

@trag-bot didn't find any issues in the code! ✅✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard
2 participants