Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-10-29 21:23:38 +0000
committerMickael Istria2019-10-29 21:23:38 +0000
commit29c2dfcb0a1d72f42b298735ef12d23803aafd63 (patch)
tree91149e0ec4371270aa7449feb32c52f95f634628
parent049ef11cbbb59d85197809bada18506a5b1ae0fe (diff)
downloadeclipse.platform.swt-29c2dfcb0a1d72f42b298735ef12d23803aafd63.tar.gz
eclipse.platform.swt-29c2dfcb0a1d72f42b298735ef12d23803aafd63.tar.xz
eclipse.platform.swt-29c2dfcb0a1d72f42b298735ef12d23803aafd63.zip
Bug 530878 - Dynamically compute isFixedLineHeight
Add update on setLineVerticalIndent Change-Id: I730bec6b45af01e79f42c1f759a678260bb4014b Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java6
2 files changed, 9 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 4b6a2f112f..71deecfe1b 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
@@ -132,6 +132,7 @@ public class StyledText extends Canvas {
boolean wordWrap = false; // text is wrapped automatically
boolean visualWrap = false; // process line breaks inside logical lines (inserted by BidiSegmentEvent)
boolean hasStyleWithVariableHeight = false;
+ boolean hasVerticalIndent = false;
boolean doubleClickEnabled = true; // see getDoubleClickEnabled
boolean overwrite = false; // insert/overwrite edit mode
int textLimit = -1; // limits the number of characters the user can type in the widget. Unlimited by default.
@@ -7323,7 +7324,7 @@ boolean isBidiCaret() {
return BidiUtil.isBidiPlatform();
}
boolean isFixedLineHeight() {
- return !isWordWrap() && lineSpacing == 0 && renderer.lineSpacingProvider == null && !hasStyleWithVariableHeight;
+ return !isWordWrap() && lineSpacing == 0 && renderer.lineSpacingProvider == null && !hasStyleWithVariableHeight && !hasVerticalIndent;
}
/**
* Returns whether the given offset is inside a multi byte line delimiter.
@@ -9479,6 +9480,7 @@ public void setLineVerticalIndent(int lineIndex, int verticalLineIndent) {
verticalScrollOffset = -1;
}
renderer.setLineVerticalIndent(lineIndex, verticalLineIndent);
+ hasVerticalIndent = verticalLineIndent != 0 || renderer.hasVerticalIndent();
resetCache(lineIndex, 1);
int newBottom = getLinePixel(lineIndex + 1);
redrawLines(lineIndex, 1, oldBottom != newBottom);
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 8dd8ac9c38..d972777663 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
@@ -1928,5 +1928,11 @@ void updateRanges(int start, int replaceCharCount, int newCharCount) {
}
}
+public boolean hasVerticalIndent() {
+ return Arrays.stream(lines).filter(Objects::nonNull) //
+ .mapToInt(line -> line.verticalIndent) //
+ .anyMatch(n -> n != 0);
+}
+
}

Back to the top