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

Fix underscore character being omitted from file name in Recent Libraries list #6389

Merged
merged 2 commits into from
May 1, 2020
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue when an "Abstract field" was duplicating text, when importing from RIS file (Neurons) [#6065](https://github.com/JabRef/jabref/issues/6065)
- We fixed an issue where adding the addition of a new entry was not completely validated [#6370](https://github.com/JabRef/jabref/issues/6370)
- We fixed an issue where the blue and red text colors in the Merge entries dialog were not quite visible [#6334](https://github.com/JabRef/jabref/issues/6334)

- We fixed an issue where underscore character was removed from the file name in the Recent Libraries list in File menu [#6383](https://github.com/JabRef/jabref/issues/6383)

### Removed

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/jabref/gui/menus/FileHistoryMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ private void setItems() {
private void addItem(Path file, int num) {
String number = Integer.toString(num);
MenuItem item = new MenuItem(number + ". " + file);
// By default mnemonic parsing is set to true for anything that is Labeled, if an underscore character
// is present, it would create a key combination ALT+the succeeding character (at least for Windows OS)
// and the underscore character will be parsed (deleted).
// i.e if the file name was called "bib_test.bib", a key combination "ALT+t" will be created
// so to avoid this, mnemonic parsing should be set to false to print normally the underscore character.
item.setMnemonicParsing(false);
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add a short comment explaining why mnemonic parsing is disabled for files, so that our future us doesn't remove it in a few months because the original reason for its introduction has been forgotten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

item.setOnAction(event -> openFile(file));
getItems().add(item);
}
Expand Down