Bug 519015 - Tab after 4 spaces is not visible

fixed a regression where the text segments using wrap around are getting
over written

The fix is to ignore text segments when we are calculating default tabwidth

Change-Id: Ie7b013357204577a5a2d35ca305a13003800fdf7
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
index 5788d2e..48ee202 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
@@ -63,6 +63,7 @@
 	static final int UNDERLINE_THICK = 1 << 16;
 	static final RGB LINK_FOREGROUND = new RGB (0, 51, 153);
 	int[] invalidOffsets;
+	private boolean ignoreSegments;
 	static final char LTR_MARK = '\u200E', RTL_MARK = '\u200F';
 
 	static class StyleItem {
@@ -133,7 +134,7 @@
 
 void computeRuns() {
 	if (lineBounds != null) return;
-	String segmentsText = getSegmentsText();
+	String segmentsText = ignoreSegments ? text : getSegmentsText();
 	char[] chars = new char[segmentsText.length()];
 	segmentsText.getChars(0, chars.length, chars, 0);
 	NSString str = (NSString) new NSString().alloc();
@@ -2325,7 +2326,9 @@
 		tabBuffer.append(' ');
 	}
 	setText(tabBuffer.toString());
+	ignoreSegments = true;
 	this.defaultTabWidth = this.getTabWidth();
+	ignoreSegments = false;
 	setText (oldString);
 }