summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java11
1 files changed, 3 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 480b18914e..b790cdf2ae 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
@@ -5792,6 +5792,9 @@ void handleCompositionChanged(Event event) {
String text = event.text;
int start = event.start;
int end = event.end;
+ int charCount = content.getCharCount();
+ start = Math.min(start, charCount);
+ end = Math.min(end, charCount);
int length = text.length();
if (length == ime.getCommitCount()) {
content.replaceTextRange(start, end - start, "");
@@ -7814,14 +7817,6 @@ 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();