int startLine = (event.y + verticalScrollOffset) / lineHeight;
int startLine = (event.y - topMargin + verticalScrollOffset) / lineHeight;
void handlePaint(Event event) {	int startLine = (event.y + verticalScrollOffset) / lineHeight;	int paintYFromTopLine = (startLine - topIndex) * lineHeight;	int topLineOffset = topIndex * lineHeight - verticalScrollOffset;	int startY = paintYFromTopLine + topLineOffset;	// adjust y position for pixel based scrolling	int renderHeight = event.y + event.height - startY;	int paintY = 0;	int lineCount = content.getLineCount();	Rectangle clientArea = getClientArea();	Color background = getBackground();	Color foreground = getForeground();	Image lineBuffer;	GC lineGC;	Font font;	FontData fontData;		// Check if there is work to do. clientArea.width should never be 0	// if we receive a paint event but we never want to try and create 	// an Image with 0 width.	if (clientArea.width == 0 || event.height == 0) {				return;	}	if (isSingleLine()) {		lineCount = 1;		if (startLine > 1) {			startLine = 1;		}	}	font = event.gc.getFont();	fontData = font.getFontData()[0];	lineBuffer = new Image(getDisplay(), clientArea.width, renderHeight);	lineGC = new GC(lineBuffer);		lineGC.setFont(font);	lineGC.setForeground(foreground);	lineGC.setBackground(background);	for (int i = startLine; paintY < renderHeight && i < lineCount; i++, paintY += lineHeight) {		String line = content.getLine(i);		drawLine(line, i, paintY, lineGC, background, foreground, fontData, true);	}	if (paintY < renderHeight) {		lineGC.setBackground(background);		lineGC.setForeground(background);		lineGC.fillRectangle(0, paintY, clientArea.width, renderHeight - paintY);	}	event.gc.drawImage(lineBuffer, 0, startY);	lineGC.dispose();	lineBuffer.dispose();}