Wrap selection in a field into brackets when a bracket is inserted#15442
Conversation
Review Summary by QodoAdd bracket wrapping shorthand for protecting field terms
WalkthroughsDescription• Add bracket wrapping shorthand for protecting terms in fields
• When user selects text and types '{', selection wraps in brackets
• Implement via KeyEvent filter in FieldEditorFX component
• Include comprehensive unit tests and changelog documentation
Diagramflowchart LR
A["User selects text in field"] -- "types '{'" --> B["KeyEvent filter intercepts"]
B -- "selection exists" --> C["Wrap text in brackets"]
B -- "no selection" --> D["Insert '{' normally"]
C --> E["Display wrapped text"]
D --> E
File Changes1. jabgui/src/main/java/org/jabref/gui/fieldeditors/FieldEditorFX.java
|
Code Review by Qodo
1. Whitespace not preserved in wrap
|
✅ All tests passed ✅🏷️ Commit: 390a5d4 Learn more about TestLens at testlens.app. |
|
Will chekc this later on mac |
So, did it work? |
|
As @Siedlerchr is not complaining, I guess it is good now. If not, can always be reverted and reopened. |
|
I'll look into the failing check |
|
This looks like an interesting challenge: Inbalanced brackets in Quickfix: Just write "opening curly braces" or something insted of {. Maybe just settle for quickfix, dont believe its worth to put more time into this. |
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
Related issues and pull requests
Closes https://github.com/JabRef/jabref-issue-melting-pot/issues/1106
PR Description
When user selects a text and types '{' the selection will be wrapped in '{' and '}'. This is a shorthand for "Protect terms" feature, and similar to how code editors do with other types of brackets.
I think this will be useful. It is done by intercepting the key press event.
Right now I have not added a CHANGELOG.md entry. Will add it soon.UPD: Added. Ready for review.
Steps to test
Result: the selected word is wrapped in '{' and '}'.
2026-03-29.20-07-35.mp4
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)