@Override
  public @NotNull HighlighterIterator createIterator(int startOffset) {
    synchronized (this) {
      if (!isInSyncWithDocument()) {
        Document document = getDocument();
        assert document != null;
        if (document.isInBulkUpdate()) {
          document.setInBulkUpdate(false); // bulk mode failed
        }
        doSetText(document.getImmutableCharSequence());
      }

      int latestValidOffset = mySegments.getLastValidOffset();
      return new HighlighterIteratorImpl(Math.max(0, Math.min(startOffset, latestValidOffset)));
    }
  }
@Override
  public @NotNull HighlighterIterator createIterator(int startOffset)