else { lineCache = new ContentWidthCache(this, content); }
public StyledText2(Composite parent, int style) {	super(parent, checkStyle(style | SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND));	// set the bg/fg in the OS to ensure that these are the same as StyledText, necessary	// for ensuring that the bg/fg the IME box uses is the same as what StyledText uses	super.setForeground(getForeground());	super.setBackground(getBackground());	Display display = getDisplay();	isMirrored = (super.getStyle() & SWT.MIRRORED) != 0;	if ((style & SWT.READ_ONLY) != 0) {		setEditable(false);	}	leftMargin = rightMargin = isBidiCaret() ? BIDI_CARET_WIDTH - 1: 0;	if ((style & SWT.SINGLE) != 0 && (style & SWT.BORDER) != 0) {		leftMargin = topMargin = rightMargin = bottomMargin = 2;	}	clipboard = new Clipboard(display);	installDefaultContent();	initializeRenderer();	if ((style & SWT.WRAP) != 0) {		setWordWrap(true);	}	else {		lineCache = new ContentWidthCache(this, content);	}		defaultCaret = new Caret(this, SWT.NULL);	if (isBidiCaret()) {		createCaretBitmaps();		Runnable runnable = new Runnable() {			public void run() {				int direction = BidiUtil.getKeyboardLanguage() == BidiUtil.KEYBOARD_BIDI ? SWT.RIGHT : SWT.LEFT;				if (direction == caretDirection) return;				if (getCaret() != defaultCaret) return;				int lineIndex = getCaretLine();				String line = content.getLine(lineIndex);				int lineOffset = content.getOffsetAtLine(lineIndex);				int offsetInLine = caretOffset - lineOffset;				int newCaretX = getXAtOffset(line, lineIndex, offsetInLine);				setCaretLocation(newCaretX, getCaretLine(), direction);			}		};		BidiUtil.addLanguageListener(handle, runnable);	}	setCaret(defaultCaret);		calculateScrollBars();	createKeyBindings();	ibeamCursor = new Cursor(display, SWT.CURSOR_IBEAM);	setCursor(ibeamCursor);	installListeners();	installDefaultLineStyler();	initializeAccessible();	/** make StyledText2 visually different from StyledText for testing purpose **/	setBackground (new Color(parent.getDisplay(), 224, 237, 243));}