summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2012-09-27 12:59:30 -0400
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-09-27 13:00:21 -0400
commitee0ffc0c1bf96f679a31f66890d19720c01f05c6 (patch)
tree42b356b1f0753b0fc1b64e71a846ffb2b124cd1b
parent5506cab4b428c80e29a6e4456dfb962867ed7143 (diff)
downloadeclipse.platform.swt-ee0ffc0c1bf96f679a31f66890d19720c01f05c6.tar.gz
eclipse.platform.swt-ee0ffc0c1bf96f679a31f66890d19720c01f05c6.tar.xz
eclipse.platform.swt-ee0ffc0c1bf96f679a31f66890d19720c01f05c6.zip
Bug 383392 - StyledText throws exception Index out of bounds when calling setText() after Chinese character input
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java8
1 files changed, 8 insertions, 0 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 41a9db9c76..041e97386c 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
@@ -7794,6 +7794,14 @@ void reset() {
if (horizontalBar != null) {
horizontalBar.setSelection(0);
}
+ if (ime != null) {
+ String text = ime.getText();
+ if (text != null && text.length() > 0 && ime.getCompositionOffset() != -1) {
+ ime.setCompositionOffset(0);
+ content.replaceTextRange(0, 0, text);
+ setCaretOffset(ime.getCaretOffset(), SWT.DEFAULT);
+ }
+ }
resetCache(0, 0);
setCaretLocation();
super.redraw();