startIndex = startLine + replaceLineCount; endIndex = startLine + newLineCount; System.arraycopy(lines, startIndex, lines, endIndex, lineCount - startIndex); for (int i = startLine; i < endIndex; i++) { lines[i] = null; } for (int i = lineCount + delta; i < lineCount; i++) { lines[i] = null;
updateBullets(startLine, replaceLineCount, newLineCount, true); if (lines != null) { startIndex = startLine + replaceLineCount; endIndex = startLine + newLineCount; System.arraycopy(lines, startIndex, lines, endIndex, lineCount - startIndex); for (int i = startLine; i < endIndex; i++) { lines[i] = null; } for (int i = lineCount + delta; i < lineCount; i++) { lines[i] = null; }
void textChanging(TextChangingEvent event) {	int start = event.start;	int newCharCount = event.newCharCount, replaceCharCount = event.replaceCharCount;	int newLineCount = event.newLineCount, replaceLineCount = event.replaceLineCount;		updateRanges(start, replaceCharCount, newCharCount);			int startLine = content.getLineAtOffset(start);	if (replaceCharCount == content.getCharCount()) lines = null;	if (replaceLineCount == lineCount) {		lineCount = newLineCount;		lineWidth = new int[lineCount];		lineHeight = new int[lineCount];		reset(0, lineCount);	} else {		int delta = newLineCount - replaceLineCount;		if (lineCount + delta > lineWidth.length) {			int[] newWidths = new int[lineCount + delta + GROW];			System.arraycopy(lineWidth, 0, newWidths, 0, lineCount);			lineWidth = newWidths;						int[] newHeights = new int[lineCount + delta + GROW];			System.arraycopy(lineHeight, 0, newHeights, 0, lineCount);			lineHeight = newHeights;		}		if (lines != null) {			if (lineCount + delta > lines.length) {				LineInfo[] newLines = new LineInfo[lineCount + delta + GROW];				System.arraycopy(lines, 0, newLines, 0, lineCount);				lines = newLines;			}		}		int startIndex = startLine + replaceLineCount + 1;		int endIndex = startLine + newLineCount + 1;		System.arraycopy(lineWidth, startIndex, lineWidth, endIndex, lineCount - startIndex);		System.arraycopy(lineHeight, startIndex, lineHeight, endIndex, lineCount - startIndex);		for (int i = startLine; i < endIndex; i++) {			lineWidth[i] = lineHeight[i] = -1;		}		for (int i = lineCount + delta; i < lineCount; i++) {			lineWidth[i] = lineHeight[i] = -1;		}		if (layouts != null) {			int layoutStartLine = startLine - topIndex;			int layoutEndLine = layoutStartLine + replaceLineCount + 1;			for (int i = layoutStartLine; i < layoutEndLine; i++) {				if (0 <= i && i < layouts.length) {					if (layouts[i] != null) layouts[i].dispose();					layouts[i] = null;				}			}			if (delta > 0) {				for (int i = layouts.length - 1; i >= layoutEndLine; i--) {					if (0 <= i && i < layouts.length) {						endIndex = i + delta;						if (0 <= endIndex && endIndex < layouts.length) {							layouts[endIndex] = layouts[i];							layouts[i] = null;						} else {							if (layouts[i] != null) layouts[i].dispose();							layouts[i] = null;						}					}				}			} else if (delta < 0) {				for (int i = layoutEndLine; i < layouts.length; i++) {					if (0 <= i && i < layouts.length) {						endIndex = i + delta;						if (0 <= endIndex && endIndex < layouts.length) {							layouts[endIndex] = layouts[i];							layouts[i] = null;						} else {							if (layouts[i] != null) layouts[i].dispose();							layouts[i] = null;						}					}				}			}		}		if (lines != null && !(replaceLineCount == 0 && newLineCount == 0)) {			int startLineOffset = content.getOffsetAtLine(startLine);			if (startLineOffset != start) startLine++;			startIndex = startLine + replaceLineCount;			endIndex = startLine + newLineCount;			System.arraycopy(lines, startIndex, lines, endIndex, lineCount - startIndex);			for (int i = startLine; i < endIndex; i++) {				lines[i] = null;			}			for (int i = lineCount + delta; i < lineCount; i++) {				lines[i] = null;			}		}		lineCount += delta;				if (maxWidthLineIndex != -1 && startLine <= maxWidthLineIndex && maxWidthLineIndex <= startLine + replaceLineCount) {			maxWidth = 0;			maxWidthLineIndex = -1;			for (int i = 0; i < lineCount; i++) {				if (lineWidth[i] > maxWidth) {					maxWidth = lineWidth[i];					maxWidthLineIndex = i;				}			}		}	}	}