Skip to content
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

fixed the first underscore which was ignored #12455

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

laky241
Copy link

@laky241 laky241 commented Feb 3, 2025

Fixes #12215

When multiple files were attached the tooltip and context menu in the "Linked File" tab removed the first underscore (_) from file names.

the file paths were correct internally and opened the right files.

javaFX treats _ as a shortcut key indicator

I updated ControlHelper.truncateString() to replace single underscores (_) with double underscores (__) before displaying text in the UI.

attached the SS of the fix

Screenshot 2025-02-03 224324

Mandatory checks

  • I own the copyright of the code submitted and I licence 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 (for UI changes)
  • 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.

@Siedlerchr
Copy link
Member

Siedlerchr commented Feb 3, 2025

Thanks, please add a changelog entry and add a test

@subhramit
Copy link
Member

@laky241 do not remove the mandatory checks from the PR description.

@laky241
Copy link
Author

laky241 commented Feb 3, 2025

@subhramit I’ll keep this in mind for future PRs. If there’s a way to add the mandatory checks now, please guide me, and I’ll update it.

@laky241
Copy link
Author

laky241 commented Feb 4, 2025

@Siedlerchr @subhramit

when i was fixing this issue I noticed that when hovering over the Linked File tab in JabRef, the tooltip only displays the first attached file instead of listing all linked files.

I wanted to confirm if this is a known issue or intended behavior. If it's unintended, I’d be happy to work on a fix.
Screenshot 2025-02-04 224649

@@ -119,6 +119,7 @@ public static String truncateString(String text, int maxCharacters, String ellip
if (ellipsisString == null) {
ellipsisString = "";
}
text = text.replace("_", "__");
Copy link
Member

Choose a reason for hiding this comment

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

a) this will replace every occurend of an underscore. We only need to do ths if the first char is a underscore
b) This is not the correct position to do the replacement as the method should not do any magic as otherwise specificed (e.g. truncate)

=> Better create a new method for replaceFirstUnderscore and call this where needed

@Siedlerchr Siedlerchr marked this pull request as draft February 6, 2025 19:08
@calixtus
Copy link
Member

calixtus commented Feb 6, 2025

Please note: If you do not guarantee that you own the copyright to your changes and you licence them under the terms of the MIT license agreement, we cannot accept your changes.

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.

The first underscore character is ignored when displaying more than one filename in Linked file column.
4 participants