summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMarkus Keller2012-04-12 17:23:28 (EDT)
committer Silenio Quarti2012-04-12 17:23:28 (EDT)
commit63bb510957dc2c8abd27fac2be7e4080128e6ace (patch)
treefc32eccec7fd0a2f3b82c3988eff60edd1a5c8e2
parentb066a890fd4acd9279278bb7b913786a38b3a723 (diff)
downloadeclipse.platform.swt-63bb510957dc2c8abd27fac2be7e4080128e6ace.zip
eclipse.platform.swt-63bb510957dc2c8abd27fac2be7e4080128e6ace.tar.gz
eclipse.platform.swt-63bb510957dc2c8abd27fac2be7e4080128e6ace.tar.bz2
Bug 365961 - StyledText computes wrong control size when wrapping
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
index 9dc35ab..4cc4d4b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1713,7 +1713,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) {
TextLayout layout = renderer.getTextLayout(lineIndex);
int wrapWidth = layout.getWidth();
- if (wordWrap) layout.setWidth(wHint == 0 ? 1 : wHint);
+ if (wordWrap) layout.setWidth(wHint == 0 ? 1 : wHint == SWT.DEFAULT ? SWT.DEFAULT : Math.max(1, wHint - leftMargin - rightMargin));
Rectangle rect = layout.getBounds();
height += rect.height;
width = Math.max(width, rect.width);