Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2016-05-03 14:32:19 +0000
committerNiraj Modi2016-05-06 12:35:04 +0000
commit53a1a379664b562e9aecebb64a52f95d96029227 (patch)
tree3967deaaa6dad687676b17fd9bb6d3d019b23ac1
parent6c57834c58239a93119a59d25acd62a9c9045fd7 (diff)
downloadeclipse.platform.swt-53a1a379664b562e9aecebb64a52f95d96029227.tar.gz
eclipse.platform.swt-53a1a379664b562e9aecebb64a52f95d96029227.tar.xz
eclipse.platform.swt-53a1a379664b562e9aecebb64a52f95d96029227.zip
Bug 452141 - IllegalArgumentException in TextLayout._getOffset
(IME.WM_IME_COMPOSITION) Change-Id: I3fbac8e1c218abf0021886fd7b67a857fdd04c4f Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java2
1 files changed, 1 insertions, 1 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 3298aa831e..9a0aaf5079 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
@@ -3694,8 +3694,8 @@ Rectangle getBoundsAtOffset(int offset) {
String line = content.getLine(lineIndex);
Rectangle bounds;
if (line.length() != 0) {
- int offsetInLine = Math.max (0, offset - lineOffset);
TextLayout layout = renderer.getTextLayout(lineIndex);
+ int offsetInLine = Math.min (layout.getText().length(), Math.max (0, offset - lineOffset));
if (caretAlignment == PREVIOUS_OFFSET_TRAILING && offsetInLine != 0) {
offsetInLine = layout.getPreviousOffset(offsetInLine, SWT.MOVEMENT_CLUSTER);
Point point = layout.getLocation(offsetInLine, true);

Back to the top