Bug 530878 - Dynamically compute isFixedLineHeight

Add update on setLineVerticalIndent

Change-Id: I730bec6b45af01e79f42c1f759a678260bb4014b
Signed-off-by: Mickael Istria <mistria@redhat.com>
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 4b6a2f1..71deecf 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 @@
 	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 @@
 	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 @@
 		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 8dd8ac9..d972777 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 @@
 	}
 }
 
+public boolean hasVerticalIndent() {
+	return Arrays.stream(lines).filter(Objects::nonNull) //
+			.mapToInt(line -> line.verticalIndent) //
+			.anyMatch(n -> n != 0);
+}
+
 
 }