Skip to content

Allow manual entry of keywords with escaped delimiters #14780

@BOgdAnSAM-sudo

Description

@BOgdAnSAM-sudo

Is your suggestion for improvement related to a problem? Please describe.

When I was working on #12810, I noticed that it isn't possible to manually enter a keyword containing an escaped delimiter; it works only if I paste the whole keyword.

For example, when I try to create the single keyword "keyword1, keyword2", as soon as I type "keyword1\,", a new keyword "keyword1\" is created. If I continue typing "keyword2", I end up with two separate keywords: "keyword1\" and "keyword2". However, if I paste the string "keyword1\, keyword2", it behaves as expected and creates a single keyword.

This happens due to logic in org/jabref/gui/fieldeditors/KeywordsEditor;

String keywordSeparator = String.valueOf(viewModel.getKeywordSeparator());
keywordTagsField.getEditor().setOnKeyReleased(event -> {
if (event.getText().equals(keywordSeparator)) {
keywordTagsField.commit();
event.consume();
}
});
it checks every symbol that is typed into the field, and if this symbol is a delimiter, it automatically commits the new keyword.

I believe this is confusing for the user and defeats the purpose of the reworked keyword parsing logic.

Describe the solution you'd like
I have two ideas on how to resolve this issue:

  1. Remove the auto-commit logic from KeywordsEditor altogether, so the user must press Enter to create a new keyword.
  2. Enhance the logic in KeywordsEditor to check if the separator was escaped before committing the keyword.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions