diff --git a/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java
index c3ce4d470..6b1817990 100644
--- a/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java
+++ b/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java
@@ -71,7 +71,7 @@ public class BugReportDialog extends JDialog {
"gapleft para, split 2, gapright rel");
panel.add(new URLLabel(REPORT_EMAIL_URL, REPORT_EMAIL), "growx, wrap para");
- final JEditorPane editorPane = new JEditorPane("text/html", message.replace("\n", "
"));
+ final JEditorPane editorPane = new JEditorPane("text/html", formatNewlineHTML(message));
editorPane.putClientProperty(JTextPane.HONOR_DISPLAY_PROPERTIES, true);
editorPane.setPreferredSize(new Dimension(600, 400));
editorPane.setEditable(true);
@@ -241,5 +241,16 @@ public class BugReportDialog extends JDialog {
sb.append(l.toString()).append('\n');
}
}
+
+ /**
+ * Replace newline character \n to an HTML newline. Instead of just using a
tag, we replace newlines with a
+ * paragraph tag with zero margin. This is so that when you copy the HTML text and paste it somewhere, that the
+ * HTML newlines are also interpreted as newlines in the new text. A
tag would just be replaced by a space.
+ * @param text text to be formatted
+ * @return text with HTML newlines
+ */
+ private static String formatNewlineHTML(String text) {
+ return text.replaceAll("\n(.*?)(?=(\n|$))", "
$1
"); + } }