diff options
author | Markus Keller | 2012-04-12 21:23:28 +0000 |
---|---|---|
committer | Silenio Quarti | 2012-04-12 21:23:28 +0000 |
commit | 63bb510957dc2c8abd27fac2be7e4080128e6ace (patch) | |
tree | fc32eccec7fd0a2f3b82c3988eff60edd1a5c8e2 | |
parent | b066a890fd4acd9279278bb7b913786a38b3a723 (diff) | |
download | eclipse.platform.swt-63bb510957dc2c8abd27fac2be7e4080128e6ace.tar.gz eclipse.platform.swt-63bb510957dc2c8abd27fac2be7e4080128e6ace.tar.xz eclipse.platform.swt-63bb510957dc2c8abd27fac2be7e4080128e6ace.zip |
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.java | 4 |
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 9dc35aba62..4cc4d4ba31 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); |