void () { myNextIsFoldRegion = false; myStartOffset = myEndOffset; advanceSegmentHighlighters(); advanceCurrentSelectionIndex(); if (!myUseOnlyFullLineHighlighters) { myCurrentFold = myFoldingModel == null ? null : myFoldingModel.getCollapsedRegionAtOffset(myReverseIteration ? myStartOffset - 1 : myStartOffset); } if (myCurrentFold != null) { myEndOffset = myReverseIteration ? myCurrentFold.getStartOffset() : myCurrentFold.getEndOffset(); assert !DocumentUtil.isInsideSurrogatePair(myDocument, myEndOffset); } else { int highlighterEnd = getHighlighterEnd(myStartOffset); int selectionEnd = getSelectionEnd(); int minSegmentHighlightersEnd = getMinSegmentHighlightersEnd(); int foldRangesEnd = getFoldRangesEnd(myStartOffset); int caretEnd = getCaretEnd(myStartOffset); int guardedBlockEnd = getGuardedBlockEnd(myStartOffset); myEndOffset = highlighterEnd; setEndOffsetIfCloser(selectionEnd); setEndOffsetIfCloser(minSegmentHighlightersEnd); setEndOffsetIfCloser(foldRangesEnd); setEndOffsetIfCloser(caretEnd); setEndOffsetIfCloser(guardedBlockEnd); myNextIsFoldRegion = myEndOffset == foldRangesEnd && myEndOffset < myEnd; assert !DocumentUtil.isInsideSurrogatePair(myDocument, myEndOffset) : "caret: " + DocumentUtil.isInsideSurrogatePair(myDocument, caretEnd) + ", selection: " + DocumentUtil.isInsideSurrogatePair(myDocument, selectionEnd) + ", guarded block: " + DocumentUtil.isInsideSurrogatePair(myDocument, guardedBlockEnd) + ", folding: " + DocumentUtil.isInsideSurrogatePair(myDocument, foldRangesEnd) + ", lexer: " + DocumentUtil.isInsideSurrogatePair(myDocument, highlighterEnd) + ", highlighters: " + DocumentUtil.isInsideSurrogatePair(myDocument, minSegmentHighlightersEnd); } reinit(); }