summaryrefslogtreecommitdiffstats
path: root/bundles
diff options
context:
space:
mode:
authorKnut Radloff <kradloff>2002-03-01 19:47:17 +0000
committerKnut Radloff <kradloff>2002-03-01 19:47:17 +0000
commit7f080f182f6a92fcfdba594bc2e83c66e54d8c3d (patch)
treeef212b89360d96ea700cc6f6551153bd2fb47e86 /bundles
parenta56525ddb41b82034aaca3e68e3094b41b1d92ee (diff)
downloadeclipse.platform.swt-7f080f182f6a92fcfdba594bc2e83c66e54d8c3d.tar.gz
eclipse.platform.swt-7f080f182f6a92fcfdba594bc2e83c66e54d8c3d.tar.xz
eclipse.platform.swt-7f080f182f6a92fcfdba594bc2e83c66e54d8c3d.zip
fixes bug 9191bidi_printing_wip
Diffstat (limited to 'bundles')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java8
2 files changed, 28 insertions, 8 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 a7c2cefef6..39589740d7 100755
--- 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
@@ -1485,15 +1485,27 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
count = content.getLineCount();
}
if (wordWrap) {
- if (wHint != SWT.DEFAULT) {
- width = wHint;
- }
- else {
- width = DEFAULT_WIDTH;
+ if (((WrappedContent) content).getVisualLineCount() != 0) {
+ // lines have already been wrapped to a specific width.
+ // use existing line count. fixes bug 9191
+ width = lineCache.getWidth();
+ if (singleLine == false) {
+ count = content.getLineCount();
+ }
}
- if (singleLine == false) {
- ((WrappedContent) content).wrapLines(width);
- count = content.getLineCount();
+ else {
+ // lines have not been wrapped yet. wrap to width hint
+ // or to default width.
+ if (wHint != SWT.DEFAULT) {
+ width = wHint;
+ }
+ else {
+ width = DEFAULT_WIDTH;
+ }
+ if (singleLine == false) {
+ ((WrappedContent) content).wrapLines(width);
+ count = content.getLineCount();
+ }
}
}
else
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java
index bf05aadb17..ad66908e37 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/WrappedContent.java
@@ -199,6 +199,14 @@ public String getTextRange(int start, int length) {
return logicalContent.getTextRange(start, length);
}
/**
+ * Returns the number of visual (wrapped) lines.
+ *
+ * @return the number of visual (wrapped) lines
+ */
+int getVisualLineCount() {
+ return visualLineCount;
+}
+/**
* Returns the offset of the character after the word at the specified
* offset.
* <p>