@Override public void onFoldProcessingEnd() { if (myDocument.isInBulkUpdate()) return; if (myFoldingChangeStartOffset <= myFoldingChangeEndOffset) { doInvalidateRange(myFoldingChangeStartOffset, myFoldingChangeEndOffset); } myFoldingChangeStartOffset = Integer.MAX_VALUE; myFoldingChangeEndOffset = Integer.MIN_VALUE; for (TextRange range : myDeferredRanges) { onTextLayoutPerformed(range.getStartOffset(), range.getEndOffset()); } myDeferredRanges.clear(); assertValidState(); }
private int calculatePreferredWidth() { if (checkDirty()) return 1; assertValidState(); VisualLinesIterator iterator = new VisualLinesIterator(myView, 0); int maxWidth = 0; while (!iterator.atEnd()) { int visualLine = iterator.getVisualLine(); int width = myLineWidths.get(visualLine); if (width == UNKNOWN_WIDTH) { final Ref<Boolean> approximateValue = new Ref<Boolean>(Boolean.FALSE); width = getVisualLineWidth(iterator, () -> approximateValue.set(Boolean.TRUE)); if (approximateValue.get()) width = -width; myLineWidths.set(visualLine, width); } maxWidth = Math.max(maxWidth, Math.abs(width)); iterator.advance(); } return maxWidth; }
@TestOnly public void validateState() { assertValidState(); }
@Override public void documentChanged(DocumentEvent event) { if (myDocument.isInBulkUpdate()) return; doInvalidateRange(myDocumentChangeStartOffset, myDocumentChangeEndOffset); assertValidState(); }