diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2013-05-06 12:58:51 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2013-05-06 12:58:51 -0400 |
commit | c344dba8cb6458ad0164d542d97fb40c8ff638c8 (patch) | |
tree | b604d317dfcaf3f366f3c61e74e82efdf5f9be36 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets | |
parent | f1f45c74fe38a901552d12f65eebf46b85a192dd (diff) | |
download | eclipse.platform.swt-c344dba8cb6458ad0164d542d97fb40c8ff638c8.tar.gz eclipse.platform.swt-c344dba8cb6458ad0164d542d97fb40c8ff638c8.tar.xz eclipse.platform.swt-c344dba8cb6458ad0164d542d97fb40c8ff638c8.zip |
Bug 406623 - [DBCS4.3]: The first character in empty StyledText is duplicated when using custom StyledTextContent
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
2 files changed, 4 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(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java index f3ce6d2e24..3a441c092c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java @@ -941,6 +941,7 @@ TextLayout getTextLayout(int lineIndex, int orientation, int width, int lineSpac int end = imeRanges[i*2+1] - lineOffset; TextStyle imeStyle = imeStyles[i], userStyle; for (int j = start; j <= end; j++) { + if (!(0 <= j && j < length)) break; userStyle = layout.getStyle(j); if (userStyle == null && j > 0) userStyle = layout.getStyle(j - 1); if (userStyle == null && j + 1 < length) userStyle = layout.getStyle(j + 1); |