lastLine = content.getLineAtOffset(lastEnd);
int firstLine = content.getLineAtOffset(ranges[0].start); int lastLine = content.getLineAtOffset(lastEnd);
public void setStyleRanges(StyleRange[] ranges) {	checkWidget();	// this API can not be used if the client is providing the line styles	if (userLineStyle) {		return;	} 	if (ranges == null) { 		SWT.error(SWT.ERROR_NULL_ARGUMENT); 	} 	// check the last range, make sure it falls within the range of the 	// current text  	if (ranges.length != 0) { 		StyleRange last = ranges[ranges.length-1]; 		int lastEnd = last.start + last.length;		int firstLine = content.getLineAtOffset(ranges[0].start);		int lastLine;		if (lastEnd > content.getCharCount()) {			SWT.error(SWT.ERROR_INVALID_RANGE);		} 			lastLine = content.getLineAtOffset(lastEnd);		// reset all lines affected by the style change		lineCache.reset(firstLine, lastLine - firstLine + 1, true); 	} 	else {		// reset all lines		lineCache.reset(0, content.getLineCount(), false); 	}	defaultLineStyler.setStyleRanges(ranges);	redraw(); // should only redraw affected area to avoid flashing	// make sure that the caret is positioned correctly.	// caret location may change if font style changes.	// fixes 1G8FODP	setCaretLocation();}