Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorazerr2018-04-26 09:23:34 +0000
committerMickael Istria2018-04-26 09:37:59 +0000
commit7283c66382291ec1d3eff3a3d435a713c1dd23e3 (patch)
treea10c6530ff8f5871efe3edde20325d7ba1c4448c
parentb74e4e29d522717c5e10af940ac8dfb70029c64d (diff)
downloadeclipse.platform.swt-7283c66382291ec1d3eff3a3d435a713c1dd23e3.tar.gz
eclipse.platform.swt-7283c66382291ec1d3eff3a3d435a713c1dd23e3.tar.xz
eclipse.platform.swt-7283c66382291ec1d3eff3a3d435a713c1dd23e3.zip
Bug 534080 - [StyledText] java.lang.IllegalArgumentException: Index out
of bounds when setCaretLocation Change-Id: Ic1389869f060bd8023e9744387ecaa9667c6c548 Signed-off-by: azerr <angelo.zerr@gmail.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java14
1 files changed, 8 insertions, 6 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 15c7882a0c..651869e8b9 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
@@ -8643,12 +8643,14 @@ void setCaretLocation(final Point location, int direction) {
int caretHeight = getLineHeight();
boolean isTextAlignedAtBottom = true;
- for (StyleRange style : getStyleRanges(graphicalLineFirstOffset, graphicalLineLastOffset - graphicalLineFirstOffset)) {
- isTextAlignedAtBottom &= (
- (style.font == null || Objects.equals(style.font, getFont())) &&
- style.rise >= 0 &&
- (style.metrics == null || style.metrics.descent <= 0)
- );
+ if (graphicalLineFirstOffset >= 0) {
+ for (StyleRange style : getStyleRanges(graphicalLineFirstOffset, graphicalLineLastOffset - graphicalLineFirstOffset)) {
+ isTextAlignedAtBottom &= (
+ (style.font == null || Objects.equals(style.font, getFont())) &&
+ style.rise >= 0 &&
+ (style.metrics == null || style.metrics.descent <= 0)
+ );
+ }
}
if (!isTextAlignedAtBottom || (styleAtOffset != null && styleAtOffset.isVariableHeight())) {
if (isDefaultCaret) {

Back to the top