void (int startLine, int oldEndLine, int newEndLine, boolean textChanged, boolean bidiRequiredForNewText) { checkDisposed(); if (textChanged) { LineLayout firstOldLine = startLine >= 0 && startLine < myLines.size() ? myLines.get(startLine) : null; LineLayout lastOldLine = oldEndLine >= 0 && oldEndLine < myLines.size() ? myLines.get(oldEndLine) : null; if (firstOldLine == null || lastOldLine == null || !firstOldLine.isLtr() || !lastOldLine.isLtr()) bidiRequiredForNewText = true; } int endLine = Math.min(oldEndLine, newEndLine); for (int line = startLine; line <= endLine; line++) { LineLayout lineLayout = myLines.get(line); if (lineLayout != null) { removeChunksFromCache(lineLayout); myLines.set(line, (textChanged && bidiRequiredForNewText) || !lineLayout.isLtr() ? null : myBidiNotRequiredMarker); } } if (oldEndLine < newEndLine) { myLines.addAll(oldEndLine + 1, Collections.nCopies(newEndLine - oldEndLine, null)); } else if (oldEndLine > newEndLine) { List<LineLayout> layouts = myLines.subList(newEndLine + 1, oldEndLine + 1); for (LineLayout layout : layouts) { if (layout != null) { removeChunksFromCache(layout); } } layouts.clear(); } }