Example #1
0
  @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();
  }
Example #2
0
 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;
 }
Example #3
0
 @TestOnly
 public void validateState() {
   assertValidState();
 }
Example #4
0
 @Override
 public void documentChanged(DocumentEvent event) {
   if (myDocument.isInBulkUpdate()) return;
   doInvalidateRange(myDocumentChangeStartOffset, myDocumentChangeEndOffset);
   assertValidState();
 }