From 775802f98c74cb1e2e998507889a5bb2b10cd333 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 4 Sep 2019 19:17:24 +0200 Subject: [PATCH] UI DSL: Don't restrict max line length of commentRow GitOrigin-RevId: 987a8e59f2243c2aa3e686471c66aae29d59ce3f --- .../com/intellij/openapi/ui/panel/ComponentPanelBuilder.java | 4 ++-- platform/platform-impl/src/com/intellij/ui/layout/Row.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java b/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java index 68699f5054e9..3bbefd21a4f6 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/panel/ComponentPanelBuilder.java @@ -282,8 +282,8 @@ public class ComponentPanelBuilder implements GridBagPanelBuilder { "a:active {color:#" + ColorUtil.toHex(JBUI.CurrentTheme.Link.linkPressedColor()) + ";}\n" + //"body {background-color:#" + ColorUtil.toHex(JBColor.YELLOW) + ";}\n" + // Left for visual debugging "\n"; - if (commentText.length() > maxLineLength && isCommentBelow) { - int width = component.getFontMetrics(component.getFont()).stringWidth(commentText.substring(0, 70)); + if (maxLineLength > 0 && commentText.length() > maxLineLength && isCommentBelow) { + int width = component.getFontMetrics(component.getFont()).stringWidth(commentText.substring(0, maxLineLength)); component.setText(String.format("" + css + "
%s
", width, commentText)); } else { diff --git a/platform/platform-impl/src/com/intellij/ui/layout/Row.kt b/platform/platform-impl/src/com/intellij/ui/layout/Row.kt index 7d56930cc772..d3171f3a788f 100644 --- a/platform/platform-impl/src/com/intellij/ui/layout/Row.kt +++ b/platform/platform-impl/src/com/intellij/ui/layout/Row.kt @@ -62,7 +62,7 @@ interface RowBuilder : BaseBuilder { } fun commentRow(text: String) { - createNoteOrCommentRow(ComponentPanelBuilder.createCommentComponent(text, true)) + createNoteOrCommentRow(ComponentPanelBuilder.createCommentComponent(text, true, -1)) } }