diff --git a/CHANGELOG.md b/CHANGELOG.md index eac14594f4e..813015384ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Window state is saved on close and restored on start. - Files without a defined external file type are now directly opened with the default aplication of the operating system - We streamlined the process to rename and move files by removing the confirmation dialogs. +- We removed the redundant new lines of marking and wrapped the summary in File annotation tab. diff --git a/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabView.java b/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabView.java index f49edc1ace6..ab55a719040 100644 --- a/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabView.java +++ b/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabView.java @@ -94,12 +94,14 @@ private Node createFileAnnotationNode(FileAnnotationViewModel annotation) { Label date = new Label(annotation.getDate()); Label page = new Label(Localization.lang("Page") + ": " + annotation.getPage()); - marking.setStyle("-fx-font-weight: bold"); + marking.setStyle("-fx-font-size: 10px; -fx-font-weight: bold"); marking.setMaxHeight(30); // add alignment for text in the list marking.setTextAlignment(TextAlignment.LEFT); marking.setAlignment(Pos.TOP_LEFT); + marking.setMaxWidth(500); + marking.setWrapText(true); author.setTextAlignment(TextAlignment.LEFT); author.setAlignment(Pos.TOP_LEFT); date.setTextAlignment(TextAlignment.RIGHT); diff --git a/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModel.java b/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModel.java index 85ae94d5b42..091f0114eef 100644 --- a/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModel.java +++ b/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModel.java @@ -31,7 +31,11 @@ private void setupContentProperties(FileAnnotation annotation) { this.content.set(annotation.getLinkedFileAnnotation().getContent()); String annotationContent = annotation.getContent(); String illegibleTextMessage = Localization.lang("The marked area does not contain any legible text!"); - this.marking.set(annotationContent.isEmpty() ? illegibleTextMessage : annotationContent); + String markingContent = (annotationContent.isEmpty() ? illegibleTextMessage : annotationContent); + // remove newlines && hyphens before linebreaks + markingContent = new RemoveHyphenatedNewlinesFormatter().format(markingContent); + markingContent = new RemoveNewlinesFormatter().format(markingContent); + this.marking.set(markingContent); } else { String content = annotation.getContent(); // remove newlines && hyphens before linebreaks diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java index 2356c02cab0..8adf6e76dbf 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatter.java @@ -10,7 +10,8 @@ * Removes all hyphenated line breaks in the string. */ public class RemoveHyphenatedNewlinesFormatter extends Formatter { - private static final Pattern HYPHENATED_WORDS = Pattern.compile("(-\r\n|-\n|-\r)"); + private static final String newLine = String.format("%n"); + private static final Pattern HYPHENATED_WORDS = Pattern.compile("(-" + newLine + ")"); @Override public String getName() { diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java index c6942bf51ea..7504687f05a 100644 --- a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java @@ -10,7 +10,8 @@ * Removes all line breaks in the string. */ public class RemoveNewlinesFormatter extends Formatter { - private static final Pattern LINEBREAKS = Pattern.compile("(\r?\n|\r)"); + private static final String newLine = String.format("%n"); + private static final Pattern LINEBREAKS = Pattern.compile("(?