Ghidra is a software reverse engineering (SRE) framework
Fixed line wrapping in the error dialog
dragonmacher8a5fbdfa9a14
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.javaindex 7e7f828d28..1289cf3293 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java@@ -157,21 +157,7 @@ public class ErrLogDialog extends AbstractErrDialog {new GIconLabel(UIManager.getIcon("OptionPane.errorIcon"), SwingConstants.RIGHT),BorderLayout.WEST);- JLabel messageLabel;- if (HTMLUtilities.isHTML(message)) {- messageLabel = new GHtmlLabel(message) {- @Override- public Dimension getPreferredSize() {- // rendering HTML the label can expand larger than the screen; keep it reasonable- Dimension size = super.getPreferredSize();- size.width = 300;- return size;- }- };- }- else {- messageLabel = new GLabel(message);- }+ JLabel messageLabel = createMessageLabel(message);introPanel.add(messageLabel, BorderLayout.CENTER);@@ -209,6 +195,25 @@ public class ErrLogDialog extends AbstractErrDialog {detailsPane.selectFirstError();}+ private JLabel createMessageLabel(String message) {++ if (HTMLUtilities.isHTML(message)) {+ // Client HTML; keep as-is+ return new MaxWidthHtmlLabel(message);+ }++ if (message.indexOf('\n') != 0) {+ // JLabels do not handle newlines, so we must update the text to reflect the client's+ // desired newlines. Escape any content that may have angle brackets so it does not get+ // removed when we convert the text to HTML. Convert newlines to break tags so the+ // label will correctly line wrap as intended by the client.+ String html = HTMLUtilities.toLiteralHTML(message, 0);+ return new MaxWidthHtmlLabel(html);+ }++ return new GLabel(message);+ }+@Overrideprotected void cancelCallback() {close();@@ -270,6 +275,10 @@ public class ErrLogDialog extends AbstractErrDialog {return baseTitle;}+//=================================================================================================+// Inner Classes+//=================================================================================================+private class ErrorDetailsSplitPane extends JSplitPane {private final double TOP_PREFERRED_RESIZE_WEIGHT = .80;@@ -584,4 +593,19 @@ public class ErrLogDialog extends AbstractErrDialog {}}}++ private class MaxWidthHtmlLabel extends GHtmlLabel {++ MaxWidthHtmlLabel(String text) {+ super(text);+ }++ @Override+ public Dimension getPreferredSize() {+ // rendering HTML can expand larger than the screen; keep it reasonable+ Dimension size = super.getPreferredSize();+ size.width = 300;+ return size;+ }+ }}